1 | <?php
|
---|
2 | /* Plugin Name: Complete Site Stats
|
---|
3 | * Version: 0.1
|
---|
4 | * Plugin URI: http://www.gpearce.co.uk/plugins/complete-stats/
|
---|
5 | * Description: Complete statistics for your blog.
|
---|
6 | * Author: George Pearce
|
---|
7 | * Author URI: http://www.gpearce.co.uk/
|
---|
8 | */
|
---|
9 | // Some set variables for misc stuff.
|
---|
10 |
|
---|
11 | // for the pagerank
|
---|
12 | function prchecker() {
|
---|
13 | echo 'The pagerank of this page is <img src="http://www.getseoresults.com/free-pagerank-display.php?a=getCode&s=Google" title="Free PageRank Display Code" border="0px" alt="Free PageRank Checker Display" /><br />';
|
---|
14 | }
|
---|
15 |
|
---|
16 | // for the alexa rank
|
---|
17 | function getalexa() {
|
---|
18 | $homepageurl = get_bloginfo('home');
|
---|
19 | $request_url = "http://data.alexa.com/data?cli=10&dat=snbamz&url=".$homepageurl;
|
---|
20 | $xml = simplexml_load_file($request_url) or die ("Feed not loading, sorry");
|
---|
21 | return $xml->SD->POPULARITY['TEXT'];
|
---|
22 | }
|
---|
23 | function showalexa() {
|
---|
24 | echo "The Alexa rank of this website is "; echo getalexa(); // this needs cleaning up in release version.
|
---|
25 | }
|
---|
26 |
|
---|
27 | // checking backlinks
|
---|
28 | function yahoo_backlinks() {
|
---|
29 | ?>
|
---|
30 | <br><center><!-- START CODE -->
|
---|
31 | <script type="text/javascript" src="https://sec.yimg.com/us.yimg.com/lib/s2/yschx_siteexplorer_badge_20070709.js"></script>
|
---|
32 | <div id="ybadge" style="position:relative;left:0px;top:0px;width:105px;height:35px;z-index:1;border: 1px solid #8ea9ba;background: url(https://sec.yimg.com/us.yimg.com/i/us/sch/el/siteex_badgesml_bg.gif) repeat-x;overflow: hidden;cursor:pointer;" onclick="GotoSiteUrl()">
|
---|
33 | <div id="ylogo" style="position:absolute;left:5px;top:11px;width:18px;height:10px;z-index:1;">
|
---|
34 | <img src="https://sec.yimg.com/us.yimg.com/i/us/sch/el/siteex_badgesml_logo.gif" alt="Yahoo!" width="18" height="10" />
|
---|
35 | </div>
|
---|
36 | <div id="ynum" style="position:absolute;left:30px;top:3px;width:75px;font:bold 11px Tahoma, Verdana, Arial;color: #2d2a25;height:15px;z-index:2;text-align: center;">
|
---|
37 | <script type="text/javascript">
|
---|
38 | <!--
|
---|
39 | document.write("<scr"+"ipt type=\"text/javascript\" src=\"http://search.yahooapis.com/SiteExplorerService/V1/inlinkCount?appid=YahooBadge&entire_site=1&query="+siteurl+"&output=json&callback=ws_results\"></scr"+"ipt\>");
|
---|
40 | // -->
|
---|
41 | </script></div>
|
---|
42 | <div id="ytxt" style="position:absolute;height:15px;z-index:3;font:normal 11px Tahoma, Verdana, Arial;left:30px;top:18px;width:75px;color: #1b1a17;">
|
---|
43 | Links to Site</div></div>
|
---|
44 | <!-- END CODE --></center><br />
|
---|
45 | <?php }
|
---|
46 |
|
---|
47 | // Setting up the widget
|
---|
48 | function widget_css_launch() {
|
---|
49 | if ( function_exists('register_sidebar_widget') ) :
|
---|
50 | function widget_complete_site_stats() {
|
---|
51 | echo $before_widget;
|
---|
52 | echo $before_title . $options['title'] . $after_title;
|
---|
53 |
|
---|
54 | // The widget itself. Anything below here and above the next comment will be placed directly into the widget. ?><br />
|
---|
55 | <?php prchecker();
|
---|
56 | showalexa();
|
---|
57 | yahoo_backlinks();?>
|
---|
58 |
|
---|
59 |
|
---|
60 | <?php
|
---|
61 | // please don't remove the following credits link, and if you really must, a donation would be appreciated. gpearce.co.uk/contribute.
|
---|
62 | echo "<small>Stats by <a href='http://www.gpearce.co.uk/plugins/complete-stats/'>Complete Stats</a></small>";
|
---|
63 | echo $after_widget;
|
---|
64 | // the widget ends here. The next bit is important, please don't edit it.
|
---|
65 | }
|
---|
66 |
|
---|
67 | register_sidebar_widget('Complete Site Stats', 'widget_complete_site_stats', null, 'Complete_Site_Stats');
|
---|
68 | function widget_complete_site_stats_control() {
|
---|
69 | $options = $newoptions = get_option('widget_complete_site_stats');
|
---|
70 | if ( $_POST["complete_site_stats-submit"] ) {
|
---|
71 | $newoptions['title'] = strip_tags(stripslashes($_POST["complete_site_stats-title"]));
|
---|
72 | if ( empty($newoptions['title']) ) $newoptions['title'] = 'Stats';
|
---|
73 | }
|
---|
74 | if ( $options != $newoptions ) {
|
---|
75 | $options = $newoptions;
|
---|
76 | update_option('widget_complete_site_stats', $options);
|
---|
77 | }
|
---|
78 | $title = htmlspecialchars($options['title'], ENT_QUOTES);
|
---|
79 | }
|
---|
80 | endif;
|
---|
81 | }
|
---|
82 | add_action('init', 'widget_css_launch');
|
---|
83 |
|
---|
84 | /* And we're finished. This plugin took about 5 hours of my work, and if you find any problems, post them on my bug tracker
|
---|
85 | * http://bugs.gpearce.co.uk
|
---|
86 | */
|
---|
87 | ?>
|
---|