Commit d8a4f382 authored by root's avatar root Committed by lechuck
Browse files

Import wp-piwik 0.8.3

parent 9570e4da
div.wp-piwik-sortables {
margin:0 5px;
}
span.wp-piwik-details {
font-size:0.8em;
font-weight:normal;
}
div.wp-piwik-side div.wp-piwik-graph-wide {
display: none;
}
div.wp-piwik-graph-wide {
text-align:center;
padding-bottom:5px;
}
table.wp-piwik-table th.n, td.n {
text-align: right;
}
table.wp-piwik-table tr:hover {
background-color:#ccc;
}
div.wp-piwik-sidebox {
width:200px;
padding:10px;
float:right;
border:1px solid black;
background:#ffc
}
div.wp-piwik-sidebox div {
width:190px;
text-align:center;
border-top:1px solid black;
padding:5px
}
div.wp-piwik-settings-container {
margin-right:250px;
max-width:1024px;
}
div.wp-piwik-settings h4 {
float:left;
font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif !important;
font-size:12px !important;
font-weight:normal;
padding-top:5px !important;
text-align:right;
width:100px;
}
div.wp-piwik-settings h4 label {
margin-right:10px;
vertical-align:middle;
}
div.wp-piwik-settings .input-text-wrap input,
div.wp-piwik-settings .input-text-wrap select,
div.wp-piwik-settings .input-text-wrap textarea,
div.wp-piwik-settings .input-wrap input {
border:0 none;
color:#333333;
margin:0;
outline:medium none;
padding:0;
width:99%;
}
div.wp-piwik-settings .input-wrap {
margin:0 0 1em 100px;
padding:3px 3px;
}
div.wp-piwik-settings .input-text-wrap {
margin:0 0 1em 100px;
border:1px solid #CCCCCC;
padding:2px 3px;
}
div.wp-piwik_desc {
font-size:11px;
margin:0 0 10px 100px;
padding:0;
}
div.wp-piwik_desc strong {
color:#f00;
}
<?php
/*********************************
WP-Piwik::Stats:Browser
**********************************/
$aryConf['data'] = $this->call_API(
'UserSettings.getBrowser',
$aryConf['params']['period'],
$aryConf['params']['date'],
$aryConf['params']['limit']
);
$aryConf['title'] = __('Browser', 'wp-piwik');
include('header.php');
$strValues = '';
$intCount = 0; $intMore = 0; $intSum = 0;
foreach ($aryConf['data'] as $key => $aryValues) {
$intCount++;
if ($intCount <= 9) $strValues .= '["'.$aryValues['shortLabel'].'",'.$aryValues['nb_uniq_visitors'].'],';
else $intMore += $aryValues['nb_uniq_visitors'];
$intSum += $aryValues['nb_uniq_visitors'];
}
if ($intMore) $strValues .= '["'.__('Others', 'wp-piwik').'",'.$intMore.'],';
$strValues = substr($strValues, 0, -1);
/***************************************************************************/ ?>
<div class="wp-piwik-graph-wide">
<div id="wp-piwik_stats_browsers_graph" style="height:310px;width:490px"></div>
</div>
<div class="table">
<table class="widefat wp-piwik-table">
<thead>
<tr>
<th><?php _e('Browser', 'wp-piwik'); ?></th>
<th class="n"><?php _e('Unique', 'wp-piwik'); ?></th>
<th class="n"><?php _e('Percent', 'wp-piwik'); ?></th>
</tr>
</thead>
<tbody>
<?php /************************************************************************/
foreach ($aryConf['data'] as $aryValues)
echo '<tr><td>'.
$aryValues['shortLabel'].
'</td><td class="n">'.
$aryValues['nb_uniq_visitors'].
'</td><td class="n">'.
number_format($aryValues['nb_uniq_visitors']/$intSum*100, 2).
'%</td></tr>';
unset($aryTmp);
/***************************************************************************/ ?>
</tbody>
</table>
</div>
<script type="text/javascript">
$j.jqplot('wp-piwik_stats_browsers_graph', [[<?php echo $strValues; ?>]], {
seriesDefaults:{renderer:$j.jqplot.PieRenderer, rendererOptions:{sliceMargin:8}},
legend:{show:true}
});
</script>
<?php /************************************************************************/
include ('footer.php');
/* EOF */
<?php
/*********************************
WP-Piwik::Stats:Footer
**********************************/
?>
</div>
</div>
<?php
/*********************************
WP-Piwik::Stats:Header
**********************************/
?>
<div id="<?php echo $aryConf['id']; ?>" class="postbox <?php echo ($aryConf['closed']?'if-js-closed':''); ?>" >
<div class="handlediv" title="Click to toggle">
<br />
</div>
<h3 class='hndle'>
<span>
<?php echo $aryConf['title']; echo ' <span class="wp-piwik-details">('.$aryConf['desc'].')</span>'; ?>
</span>
</h3>
<div class="inside">
<?php
/*********************************
WP-Piwik::Stats:Keywords
**********************************/
$aryConf['data'] = $this->call_API(
'Referers.getKeywords',
$aryConf['params']['period'],
$aryConf['params']['date'],
$aryConf['params']['limit']
);
$aryConf['title'] = __('Keywords', 'wp-piwik');
include('header.php');
/***************************************************************************/ ?>
<table class="widefat">
<thead>
<tr><th><?php _e('Keyword', 'wp-piwik'); ?></th><th><?php _e('Unique', 'wp-piwik'); ?></th></tr>
</thead>
<tbody>
<?php /************************************************************************/
foreach ($aryConf['data'] as $aryValues)
echo '<tr><td>'.$aryValues['label'].'</td><td>'.$aryValues['nb_uniq_visitors'].'</td></tr>';
/***************************************************************************/ ?>
</tbody>
</table>
<?php /************************************************************************/
include ('footer.php');
/* EOF */
<?php
/*********************************
WP-Piwik::Stats:Overview
**********************************/
$aryConf['data'] = $this->call_API(
'VisitsSummary.get',
$aryConf['params']['period'],
$aryConf['params']['date'],
$aryConf['params']['limit']
);
$aryConf['title'] = __('Overview', 'wp-piwik');
if (!isset($aryConf['inline']) || $aryConf['inline'] != true)
include('header.php');
if ($aryConf['params']['date'] == 'last30') {
$aryTmp = array(
'bounce_count' => 0,
'max_actions' => 0,
'nb_actions' => 0,
'nb_uniq_visitors' => 0,
'nb_visits' => 0,
'nb_visits_converted' => 0,
'sum_visit_length' => 0
);
foreach ($aryConf['data'] as $aryDay)
foreach ($aryDay as $strKey => $strValue)
if ($strKey != 'max_actions')
$aryTmp[$strKey] += $strValue;
elseif ($aryTmp['max_actions'] < $strValue)
$aryTmp['max_actions'] = $strValue;
$aryConf['data'] = $aryTmp;
}
/***************************************************************************/ ?>
<div class="table">
<table class="widefat">
<tbody>
<?php /************************************************************************/
$strTime =
floor($aryConf['data']['sum_visit_length']/3600).'h '.
floor(($aryConf['data']['sum_visit_length'] % 3600)/60).'m '.
floor(($aryConf['data']['sum_visit_length'] % 3600) % 60).'s';
echo '<tr><td>'.__('Visitors', 'wp-piwik').':</td><td>'.$aryConf['data']['nb_visits'].'</td></tr>';
echo '<tr><td>'.__('Unique visitors', 'wp-piwik').':</td><td>'.$aryConf['data']['nb_uniq_visitors'].'</td></tr>';
echo '<tr><td>'.__('Page views', 'wp-piwik').':</td><td>'.$aryConf['data']['nb_actions'].'</td></tr>';
echo '<tr><td>'.__('Max. page views in one visit', 'wp-piwik').':</td><td>'.$aryConf['data']['max_actions'].'</td></tr>';
echo '<tr><td>'.__('Total time spent by visitors', 'wp-piwik').':</td><td>'.$strTime.'</td></tr>';
echo '<tr><td>'.__('Bounce count', 'wp-piwik').':</td><td>'.$aryConf['data']['bounce_count'].'</td></tr>';
if (get_option('wp-piwik_piwiklink', 0))
echo '<tr><td>'.__('Shortcut', 'wp-piwik').':</td><td><a href="'.get_option('wp-piwik_url').'">Piwik</a>'.(isset($aryConf['inline']) && $aryConf['inline']?' - <a href="?page=wp-piwik/wp-piwik.php">WP-Piwik</a>':'').'</td></tr>';
/***************************************************************************/ ?>
</tbody>
</table>
</div>
<?php /************************************************************************/
if (!isset($aryConf['inline']) || isset($aryConf['inline']) != true)
include ('footer.php');
/* EOF */
<?php
/*********************************
WP-Piwik::Stats:Pages
**********************************/
$aryConf['data'] = $this->call_API(
'Actions.getPageTitles',
$aryConf['params']['period'],
$aryConf['params']['date'],
$aryConf['params']['limit']
);
$intMax = 9;
$aryConf['title'] = __('Pages', 'wp-piwik');
include('header.php');
/***************************************************************************/ ?>
<div class="table">
<table class="widefat wp-piwik-table">
<thead>
<tr>
<th><?php _e('Page', 'wp-piwik'); ?></th>
<th class="n"><?php _e('Unique', 'wp-piwik'); ?></th>
<th class="n"><?php _e('Visits', 'wp-piwik'); ?></th>
</tr>
</thead>
<tbody>
<?php /************************************************************************/
$intCount = 0; $aryOthers = array('u' => 0, 'v' => 0);
foreach ($aryConf['data'] as $aryValues) {
$intCount++;
if ($intCount > $intMax) {
$aryOthers['u'] += $aryValues['nb_uniq_visitors'];
$aryOthers['v'] += $aryValues['nb_visits'];
} else echo '<tr><td>'.
$aryValues['label'].
'</td><td class="n">'.
$aryValues['nb_uniq_visitors'].
'</td><td class="n">'.
$aryValues['nb_visits'].
'</td></tr>';
}
if (!empty($aryOthers['v'])) echo '<tr><td>'.
__('Others', 'wp-piwik').
'</td><td class="n">'.
$aryOthers['u'].
'</td><td class="n">'.
$aryOthers['v'].
'</td></tr>';
/***************************************************************************/ ?>
</tbody>
</table>
</div>
<?php /************************************************************************/
include ('footer.php');
/* EOF */
<?php
/*********************************
WP-Piwik::Stats:Plugins
**********************************/
$aryConf['data'] = $this->call_API(
'UserSettings.getPlugin',
$aryConf['params']['period'],
$aryConf['params']['date'],
$aryConf['params']['limit']
);
$aryConf['title'] = __('Plugins', 'wp-piwik');
$aryOverview = $this->call_API(
'VisitsSummary.get',
$aryConf['params']['period'],
$aryConf['params']['date'],
$aryConf['params']['limit']
);
$intTotalVisits = $aryOverview['nb_visits'];
unset($aryOverview);
include('header.php');
/***************************************************************************/ ?>
<div class="table">
<table class="widefat wp-piwik-table">
<thead>
<tr>
<th><?php _e('Plugins', 'wp-piwik'); ?></th>
<th class="n"><?php _e('Visits', 'wp-piwik'); ?></th>
<th class="n"><?php _e('Percent', 'wp-piwik'); ?></th>
</tr>
</thead>
<tbody>
<?php /************************************************************************/
foreach ($aryConf['data'] as $aryValues)
echo '<tr><td>'.
$aryValues['label'].
'</td><td class="n">'.
$aryValues['nb_visits'].
'</td><td class="n">'.
number_format(($aryValues['nb_visits']/$intTotalVisits*100),2).
'%</td></tr>';
unset($aryTmp);
/***************************************************************************/ ?>
</tbody>
</table>
</div>
<?php /************************************************************************/
include ('footer.php');
/* EOF */
<?php
/*********************************
WP-Piwik::Stats:Screens
**********************************/
$aryConf['data'] = $this->call_API(
'UserSettings.getResolution',
$aryConf['params']['period'],
$aryConf['params']['date'],
$aryConf['params']['limit']
);
$aryConf['title'] = __('Resolution', 'wp-piwik');
include('header.php');
$strValues = '';
$intCount = 0; $intMore = 0; $intSum = 0;
foreach ($aryConf['data'] as $key => $aryValues) {
$intCount++;
if ($intCount <= 9) $strValues .= '["'.$aryValues['label'].'",'.$aryValues['nb_uniq_visitors'].'],';
else $intMore += $aryValues['nb_uniq_visitors'];
$intSum += $aryValues['nb_uniq_visitors'];
}
if ($intMore) $strValues .= '["'.__('Others', 'wp-piwik').'",'.$intMore.'],';
$strValues = substr($strValues, 0, -1);
/***************************************************************************/ ?>
<div class="wp-piwik-graph-wide">
<div id="wp-piwik_stats_screens_graph" style="height:310px;width:490px"></div>
</div>
<div class="table">
<table class="widefat wp-piwik-table">
<thead>
<tr>
<th><?php _e('Resolution', 'wp-piwik'); ?></th>
<th class="n"><?php _e('Unique', 'wp-piwik'); ?></th>
<th class="n"><?php _e('Percent', 'wp-piwik'); ?></th>
</tr>
</thead>
<tbody>
<?php /************************************************************************/
foreach ($aryConf['data'] as $aryValues)
echo '<tr><td>'.
$aryValues['label'].
'</td><td class="n">'.
$aryValues['nb_uniq_visitors'].
'</td><td class="n">'.
number_format($aryValues['nb_uniq_visitors']/$intSum*100, 2).
'%</td></tr>';
unset($aryTmp);
/***************************************************************************/ ?>
</tbody>
</table>
</div>
<script type="text/javascript">
$j.jqplot('wp-piwik_stats_screens_graph', [[<?php echo $strValues; ?>]], {
seriesDefaults:{renderer:$j.jqplot.PieRenderer, rendererOptions:{sliceMargin:8}},
legend:{show:true}
});
</script>
<?php /************************************************************************/
include ('footer.php');
/* EOF */
<?php
/*********************************
WP-Piwik::Stats:Systems
**********************************/
$aryConf['data'] = $this->call_API(
'UserSettings.getOS',
$aryConf['params']['period'],
$aryConf['params']['date'],
$aryConf['params']['limit']
);
$aryConf['title'] = __('Operating System', 'wp-piwik');
include('header.php');
$strValues = '';
$intCount = 0; $intMore = 0; $intSum = 0;
foreach ($aryConf['data'] as $key => $aryValues) {
$intCount++;
if ($intCount <= 9) $strValues .= '["'.$aryValues['label'].'",'.$aryValues['nb_uniq_visitors'].'],';
else $intMore += $aryValues['nb_uniq_visitors'];
$intSum += $aryValues['nb_uniq_visitors'];
}
if ($intMore) $strValues .= '["'.__('Others', 'wp-piwik').'",'.$intMore.'],';
$strValues = substr($strValues, 0, -1);
/***************************************************************************/ ?>
<div class="wp-piwik-graph-wide">
<div id="wp-piwik_stats_systems_graph" style="height:310px;width:490px"></div>
</div>
<div class="table">
<table class="widefat wp-piwik-table">
<thead>
<tr>
<th><?php _e('Operating System', 'wp-piwik'); ?></th>
<th class="n"><?php _e('Unique', 'wp-piwik'); ?></th>
<th class="n"><?php _e('Percent', 'wp-piwik'); ?></th>
</tr>
</thead>
<tbody>
<?php /************************************************************************/
foreach ($aryConf['data'] as $aryValues)
echo '<tr><td>'.
$aryValues['label'].
'</td><td class="n">'.
$aryValues['nb_uniq_visitors'].
'</td><td class="n">'.
number_format($aryValues['nb_uniq_visitors']/$intSum*100, 2).
'%</td></tr>';
unset($aryTmp);
/***************************************************************************/ ?>
</tbody>
</table>
</div>
<script type="text/javascript">
$j.jqplot('wp-piwik_stats_systems_graph', [[<?php echo $strValues; ?>]], {
seriesDefaults:{renderer:$j.jqplot.PieRenderer, rendererOptions:{sliceMargin:8}},
legend:{show:true}
});
</script>
<?php /************************************************************************/
include ('footer.php');
/* EOF */
<?php
/*********************************
WP-Piwik::Stats:Vistors
**********************************/
$aryConf['data']['Visitors'] = $this->call_API(
'VisitsSummary.getVisits',
$aryConf['params']['period'],
$aryConf['params']['date'],
$aryConf['params']['limit']
);
$aryConf['data']['Unique'] = $this->call_API(
'VisitsSummary.getUniqueVisitors',
$aryConf['params']['period'],
$aryConf['params']['date'],
$aryConf['params']['limit']
);
$aryConf['data']['Bounced'] = $this->call_API(
'VisitsSummary.getBounceCount',
$aryConf['params']['period'],
$aryConf['params']['date'],
$aryConf['params']['limit']
);
$aryConf['title'] = __('Visitors', 'wp-piwik');
include('header.php');
$strValues = $strLabels = $strBounced = $strValuesU = $strCounter = '';
$intUSum = $intCount = 0;
foreach ($aryConf['data']['Visitors'] as $strDate => $intValue) {
$intCount++;
$strValues .= $intValue.',';
$strValuesU .= $aryConf['data']['Unique'][$strDate].',';
$strBounced .= $aryConf['data']['Bounced'][$strDate].',';
$strLabels .= '['.$intCount.',"'.substr($strDate,-2).'"],';
$intUSum += $aryConf['data']['Unique'][$strDate];
}
$intAvg = round($intUSum/30,0);
$strValues = substr($strValues, 0, -1);
$strValuesU = substr($strValuesU, 0, -1);
$strLabels = substr($strLabels, 0, -1);
$strBounced = substr($strBounced, 0, -1);
$strCounter = substr($strCounter, 0, -1);
/***************************************************************************/ ?>
<div class="wp-piwik-graph-wide">
<div id="wp-piwik_stats_vistors_graph" style="height:220px;width:490px"></div>
</div>
<div class="table">
<table class="widefat wp-piwik-table">
<thead>
<tr>
<th><?php _e('Date', 'wp-piwik'); ?></th>
<th class="n"><?php _e('Visits', 'wp-piwik'); ?></th>
<th class="n"><?php _e('Unique', 'wp-piwik'); ?></th>
<th class="n"><?php _e('Bounced', 'wp-piwik'); ?></th>
</tr>
</thead>
<tbody style="cursor:pointer;">
<?php /************************************************************************/
$aryTmp = array_reverse($aryConf['data']['Visitors']);
foreach ($aryTmp as $strDate => $intValue)
echo '<tr onclick="javascript:datelink(\''.str_replace('-', '', $strDate).'\');"><td>'.$strDate.'</td><td class="n">'.
$intValue.'</td><td class="n">'.
$aryConf['data']['Unique'][$strDate].
'</td><td class="n">'.
$aryConf['data']['Bounced'][$strDate].
'</td></tr>'."\n";
echo '<tr><td class="n" colspan="4"><strong>'.__('Unique TOTAL', 'wp-piwik').'</strong> '.__('Sum', 'wp-piwik').': '.$intUSum.' '.__('Avg', 'wp-piwik').': '.$intAvg.'</td></tr>';
unset($aryTmp);
/***************************************************************************/ ?>
</tbody>
</table>
</div>
<script type="text/javascript">
$j.jqplot('wp-piwik_stats_vistors_graph', [[<?php echo $strValues; ?>],[<?php echo $strValuesU; ?>],[<?php echo $strBounced;?>]],