/**
  * Widget.
  */
 function widget($args = array())
 {
     if (is_array($args)) {
         extract($args, EXTR_SKIP);
     }
     echo $before_widget . $before_title . $widget_name . $after_title;
     $form = new WPSDAdminConfigForm();
     if ($form->getWpsdWidgetOverview()) {
         $result = wpsd_read_cache();
         echo '<!-- WP-Stats-Dashboard - START General Stats -->';
         if (defined('WPSD_PLUGIN_URL')) {
             echo '<div align="center" id="wpsd-loading"> <img src="' . WPSD_PLUGIN_URL . '/resources/images/ajax-loader.gif" alt="' . __('loading', 'wpsd') . '" width="24" height="24" /></div>';
             echo '<div id="wpsd-stats-ranking"></div>';
         } else {
             _e('WPSD_PLUGIN_URL not defined', 'wpsd');
         }
         // Get domain.
         $domain_url = get_bloginfo('url');
         // Get shortened url.
         $s = get_option('wpsd_bitly_s');
         if ('' != $s) {
             $domain_url = $s;
         }
         echo '<br/><input type="button" value="' . __('Reload', 'wpsd') . '" class="button-primary" id="btn_wpsd_reload_2" />';
         echo '<!-- WP-Stats-Dashboard - STOP General Stats-->';
     } else {
         _e('Widget disabled check', 'wpsd');
         echo ' <a href="' . wpsd_get_settings_url() . '" title="wp-stats-dashboard settings" target="_self">' . __('settings', 'wpsd') . '</a>';
     }
     echo $after_widget;
 }
Пример #2
0
 /**
  * wp_ajax_wpsd_load_searchterms function.
  * 
  * @access public
  * @return void
  */
 function wp_ajax_wpsd_load_searchterms()
 {
     $form = new WPSDAdminConfigForm();
     if ($form->getWpsdWidgetSearchTerms()) {
         $result = wpsd_read_cache();
         '<!-- WP-Stats-Dashboard - START Search terms-->';
         // Parse Search Terms.
         $pattern = '<div id="searchterms".*?>(.*?)<\\/div>';
         preg_match_all('/' . $pattern . '/s', $result, $matches);
         $st = preg_replace('/<h4>(.*?)<\\/h4>/s', '<h5>$1</h5>', $matches[1][0]);
         $st = preg_replace('/<h3>(.*?)<\\/h3>/s', '<h4>Search Terms</h4>', $st);
         $st = str_replace('<table', '<table style="width:100%;"', $st);
         if (defined('WPSD_PLUGIN_URL')) {
             $st = str_replace('http://dashboard.wordpress.com/i/stats-icon.gif', WPSD_PLUGIN_URL . '/resources/images/stats-icon.gif', $st);
         }
         echo '<div style="overflow:hidden;">';
         echo $st;
         echo '</div>';
         echo '<!-- WP-Stats-Dashboard - STOP Search terms -->';
     } else {
         _e('Widget disabled check', 'wpsd');
         echo ' <a href="' . wpsd_get_settings_url() . '" title="wp-stats-dashboard settings" target="_self">' . __('settings', 'wpsd') . '</a>';
     }
     exit;
 }
Пример #3
0
<?php

/**
 * Auto login into Wordpress.com Stats.
 * @version 0.1
 * @author dligthart <*****@*****.**>
 * @package wp-stats-dashboard
 */
$result = wpsd_read_cache();
switch ($view) {
    case 'generalstats':
        echo '<!-- WP-Stats-Dashboard - START General Stats -->';
        // Parse General Stats
        $pattern = '<div id="generalblog".*?>(.*?)<\\/div>';
        preg_match_all('/' . $pattern . '/s', $result, $matches);
        $generalStats = preg_replace('/<h3>(.*?)<\\/h3>/s', '<h4>General Blog Stats</h4>', $matches[1][0]);
        echo $generalStats;
        echo '<!-- WP-Stats-Dashboard - STOP General Stats-->';
        break;
    case 'referrers':
        echo '<br/><!-- WP-Stats-Dashboard - START Referrers -->';
        // Parse Referrers
        $pattern = '<div id="referrers".*?>(.*?)<\\/div>';
        preg_match_all('/' . $pattern . '/s', $result, $matches);
        $ref = preg_replace('/<h4>(.*?)<\\/h4>/s', '<h5>$1</h5>', $matches[1][0]);
        $ref = preg_replace('/<h3>(.*?)<\\/h3>/s', '<h4>Referrers</h4>', $ref);
        echo $ref;
        echo '<!-- WP-Stats-Dashboard - STOP Referrers-->';
        break;
    case 'postviews':
        echo '<br/><!-- WP-Stats-Dashboard - START Post views -->';