Ejemplo n.º 1
0
 /**
  * connectToService function.
  * 
  * @access public
  * @return void
  */
 function connectToService()
 {
     wpsd_login();
 }
Ejemplo n.º 2
0
<div class="wrap">

  <h2><span style="display:none;">
    <?php 
_e('WP-Stats-Dashboard Options', 'wpsd');
?>
    </span></h2>

  <img src="<?php 
echo WPSD_PLUGIN_URL;
?>
/resources/images/logo-wpstatsdashboard-300x45.png" alt="wp-stats-dashboard" width="300" height="45" />

  <?php 
if ($_REQUEST['submit']) {
    if (!wpsd_login()) {
        echo '<div class="error fade"><p><strong>' . __('WordPress.com Username or password is incorrect. Stats will not load. Please create an account at <a href="http://www.wordpress.com" target="_blank" title="wordpress.com">http://www.wordpress.com</a> afterwards use those credentials below.', 'wpsd') . '</strong></p></div>';
    }
    echo '<div class="updated fade"><p><strong>' . __('Saved', 'wpsd') . '</strong></p></div>';
}
?>
  <?php 
if (!function_exists('curl_init')) {
    ?>
  <div class="error fade">
    <p> <strong>
      <?php 
    _e('CURL extension not installed:', 'wpsd');
    ?>
      </strong> &nbsp;
      <?php 
Ejemplo n.º 3
0
/**
 * wpsd_get_chart_data function.
 * 
 * @access public
 * @return string chart data
 */
function wpsd_get_chart_data()
{
    // Login.
    wpsd_login();
    $blog_id = get_option('wpsd_blog_id');
    $graph_xml_url = "http://dashboard.wordpress.com/wp-includes/charts/stats-data.php?blog={$blog_id}&page=stats&unit=1&width=670&height=265";
    //	die($graph_xml_url);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_COOKIEFILE, wpsd_get_cookie());
    curl_setopt($ch, CURLOPT_USERAGENT, WPSD_UA);
    curl_setopt($ch, CURLOPT_REFERER, get_bloginfo('wpurl') . '/wp-admin/index.php?page=stats');
    curl_setopt($ch, CURLOPT_URL, $graph_xml_url);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}