Version Description
Download this release
Release Info
Developer | Braekling |
Plugin | WP-Matomo (WP-Piwik) |
Version | 0.3.0 |
Comparing to | |
See all releases |
Code changes from version 0.2.0 to 0.3.0
- css/wp-piwik.css +20 -0
- dashboard/.htaccess +1 -0
- dashboard/browsers.php +48 -0
- dashboard/footer.php +2 -0
- dashboard/header.php +3 -0
- dashboard/keywords.php +22 -0
- dashboard/overview.php +24 -0
- dashboard/visitors.php +68 -0
- dashboard/websites.php +22 -0
- js/wp-piwik.js +7 -0
- languages/wp-piwik-de_DE.mo +0 -0
- languages/wp-piwik-de_DE.po +174 -0
- readme.txt +9 -5
- wp-piwik.php +139 -119
css/wp-piwik.css
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
span.wp-piwik-details {
|
2 |
+
font-size:0.8em;
|
3 |
+
font-weight:normal;
|
4 |
+
}
|
5 |
+
|
6 |
+
div.wp-piwik-side div.wp-piwik-graph-wide {
|
7 |
+
display: none;
|
8 |
+
}
|
9 |
+
|
10 |
+
div.wp-piwik-graph-wide {
|
11 |
+
text-align:center;
|
12 |
+
}
|
13 |
+
|
14 |
+
table.wp-piwik-table th.n, td.n {
|
15 |
+
text-align: right;
|
16 |
+
}
|
17 |
+
|
18 |
+
table.wp-piwik-table tr:hover {
|
19 |
+
background-color:#ccc;
|
20 |
+
}
|
dashboard/.htaccess
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
Deny from all
|
dashboard/browsers.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$aryConf['data'] = $this->call_API(
|
3 |
+
'UserSettings.getBrowser',
|
4 |
+
$aryConf['params']['period'],
|
5 |
+
$aryConf['params']['date'],
|
6 |
+
$aryConf['params']['limit']
|
7 |
+
);
|
8 |
+
$aryConf['title'] = __('Browser', 'wp-piwik');
|
9 |
+
include('header.php');
|
10 |
+
$strValues = $strLabels = '';
|
11 |
+
|
12 |
+
$intSum = 0;
|
13 |
+
foreach ($aryConf['data'] as $aryValues)
|
14 |
+
$intSum += $aryValues['nb_uniq_visitors'];
|
15 |
+
|
16 |
+
foreach ($aryConf['data'] as $aryValues) {
|
17 |
+
$strValues .= round(($aryValues['nb_uniq_visitors']/$intSum*100), 2).',';
|
18 |
+
$strLabels .= '|'.urlencode($aryValues['shortLabel']);
|
19 |
+
}
|
20 |
+
|
21 |
+
$strValues = substr($strValues, 0, -1);
|
22 |
+
$strLabels = substr($strLabels, 1);
|
23 |
+
|
24 |
+
$strBase = 'http://chart.apis.google.com/chart?';
|
25 |
+
$strGraph = 'cht=p&';
|
26 |
+
$strGraph .= 'chs=500x220&';
|
27 |
+
$strGraph .= 'chd=t:'.$strValues.'&';
|
28 |
+
$strGraph .= 'chl='.$strLabels.'&';
|
29 |
+
$strGraph .= 'chco=90AAD9,A0BAE9&';
|
30 |
+
?>
|
31 |
+
<div class="wp-piwik-graph-wide">
|
32 |
+
<img src="<?php echo $strBase.$strGraph; ?>" width="500" height="220" alt="Visits graph" />
|
33 |
+
</div>
|
34 |
+
<div class="table">
|
35 |
+
<table class="widefat wp-piwik-table">
|
36 |
+
<thead>
|
37 |
+
<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'); ?></tr>
|
38 |
+
</thead>
|
39 |
+
<tbody>
|
40 |
+
<?php
|
41 |
+
foreach ($aryConf['data'] as $aryValues)
|
42 |
+
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>';
|
43 |
+
unset($aryTmp);
|
44 |
+
?>
|
45 |
+
</tbody>
|
46 |
+
</table>
|
47 |
+
</div>
|
48 |
+
<?php include ('footer.php');
|
dashboard/footer.php
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
</div>
|
2 |
+
</div>
|
dashboard/header.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<div id="<?php echo $aryConf['id']; ?>" class="postbox <?php echo ($aryConf['closed']?'if-js-closed':''); ?>" >
|
2 |
+
<div class="handlediv" title="Zum Umschalten klicken"><br /></div><h3 class='hndle'><span><?php echo $aryConf['title']; echo ' <span class="wp-piwik-details">('.$aryConf['desc'].')</span>'; ?></span></h3>
|
3 |
+
<div class="inside">
|
dashboard/keywords.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$aryConf['data'] = $this->call_API(
|
3 |
+
'Referers.getKeywords',
|
4 |
+
$aryConf['params']['period'],
|
5 |
+
$aryConf['params']['date'],
|
6 |
+
$aryConf['params']['limit']
|
7 |
+
);
|
8 |
+
$aryConf['title'] = __('Keywords', 'wp-piwik');
|
9 |
+
include('header.php');
|
10 |
+
?>
|
11 |
+
<table class="widefat">
|
12 |
+
<thead>
|
13 |
+
<tr><th><?php _e('Keyword', 'wp-piwik'); ?></th><th><?php _e('Unique', 'wp-piwik'); ?></th></tr>
|
14 |
+
</thead>
|
15 |
+
<tbody>
|
16 |
+
<?php
|
17 |
+
foreach ($aryConf['data'] as $aryValues)
|
18 |
+
echo '<tr><td>'.$aryValues['label'].'</td><td>'.$aryValues['nb_uniq_visitors'].'</td></tr>';
|
19 |
+
?>
|
20 |
+
</tbody>
|
21 |
+
</table>
|
22 |
+
<?php include('footer.php'); ?>
|
dashboard/overview.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$aryConf['data'] = $this->call_API(
|
3 |
+
'VisitsSummary.get',
|
4 |
+
$aryConf['params']['period'],
|
5 |
+
$aryConf['params']['date'],
|
6 |
+
$aryConf['params']['limit']
|
7 |
+
);
|
8 |
+
$aryConf['title'] = __('Overview', 'wp-piwik');
|
9 |
+
include('header.php');
|
10 |
+
?>
|
11 |
+
<div class="table">
|
12 |
+
<table class="widefat">
|
13 |
+
<tbody>
|
14 |
+
<?php
|
15 |
+
$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';
|
16 |
+
echo '<tr><td>'.__('Visitors', 'wp-piwik').':</td><td>'.$aryConf['data']['nb_visits'].'</td></tr>';
|
17 |
+
echo '<tr><td>'.__('Unique visitors', 'wp-piwik').':</td><td>'.$aryConf['data']['nb_uniq_visitors'].'</td></tr>';
|
18 |
+
echo '<tr><td>'.__('Page views', 'wp-piwik').':</td><td>'.$aryConf['data']['nb_actions'].'</td></tr>';
|
19 |
+
echo '<tr><td>'.__('Max. page views in one visit', 'wp-piwik').':</td><td>'.$aryConf['data']['max_actions'].'</td></tr>';
|
20 |
+
echo '<tr><td>'.__('Total time spent by visitors', 'wp-piwik').':</td><td>'.$strTime.'</td></tr>';
|
21 |
+
echo '<tr><td>'.__('Bounce count', 'wp-piwik').':</td><td>'.$aryConf['data']['bounce_count'].'</td></tr>';
|
22 |
+
echo '</tbody></table>';
|
23 |
+
?></div>
|
24 |
+
<?php include('footer.php');
|
dashboard/visitors.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$aryConf['data']['Visitors'] = $this->call_API(
|
3 |
+
'VisitsSummary.getVisits',
|
4 |
+
$aryConf['params']['period'],
|
5 |
+
$aryConf['params']['date'],
|
6 |
+
$aryConf['params']['limit']
|
7 |
+
);
|
8 |
+
$aryConf['data']['Unique'] = $this->call_API(
|
9 |
+
'VisitsSummary.getUniqueVisitors',
|
10 |
+
$aryConf['params']['period'],
|
11 |
+
$aryConf['params']['date'],
|
12 |
+
$aryConf['params']['limit']
|
13 |
+
);
|
14 |
+
$aryConf['data']['Bounced'] = $this->call_API(
|
15 |
+
'VisitsSummary.getBounceCount',
|
16 |
+
$aryConf['params']['period'],
|
17 |
+
$aryConf['params']['date'],
|
18 |
+
$aryConf['params']['limit']
|
19 |
+
);
|
20 |
+
|
21 |
+
$aryConf['title'] = __('Visitors', 'wp-piwik');
|
22 |
+
include('header.php');
|
23 |
+
$strValues = $strLabels = $strBounced = $strValuesU = '';
|
24 |
+
$intMax = max($aryConf['data']['Visitors']);
|
25 |
+
while ($intMax % 10 != 0 || $intMax == 0) $intMax++;
|
26 |
+
$intStep = $intMax / 5;
|
27 |
+
while ($intStep % 10 != 0 && $intStep != 1) $intStep--;
|
28 |
+
|
29 |
+
foreach ($aryConf['data']['Visitors'] as $strDate => $intValue) {
|
30 |
+
$strValues .= round($intValue/($intMax/100),2).',';
|
31 |
+
$strValuesU .= round($aryConf['data']['Unique'][$strDate]/($intMax/100),2).',';
|
32 |
+
$strBounced .= round($aryConf['data']['Bounced'][$strDate]/($intMax/100),2).',';
|
33 |
+
$strLabels .= '|'.substr($strDate,-2);
|
34 |
+
}
|
35 |
+
$strValues = substr($strValues, 0, -1);
|
36 |
+
$strValuesU = substr($strValuesU, 0, -1);
|
37 |
+
$strBounced = substr($strBounced, 0, -1);
|
38 |
+
|
39 |
+
$strBase = 'http://chart.apis.google.com/chart?';
|
40 |
+
$strGraph = 'cht=lc&';
|
41 |
+
$strGraph .= 'chg=0,'.round($intStep/($intMax/100),2).',2,2&';
|
42 |
+
$strGraph .= 'chs=500x220&';
|
43 |
+
$strGraph .= 'chd=t:'.$strValues.'|'.$strValuesU.'|'.$strBounced.'&';
|
44 |
+
$strGraph .= 'chxl=0:'.$strLabels.'&';
|
45 |
+
$strGraph .= 'chco=90AAD9,A0BAE9,E9A0BA&';
|
46 |
+
$strGraph .= 'chm=B,D4E2ED,0,1,0|B,E4F2FD,1,2,0|B,FDE4F2,2,3,0&';
|
47 |
+
$strGraph .= 'chxt=x,y&';
|
48 |
+
$strGraph .= 'chxr=1,0,'.$intMax.','.$intStep;
|
49 |
+
?>
|
50 |
+
<div class="wp-piwik-graph-wide">
|
51 |
+
<img src="<?php echo $strBase.$strGraph; ?>" width="500" height="220" alt="Visits graph" />
|
52 |
+
</div>
|
53 |
+
<div class="table">
|
54 |
+
<table class="widefat wp-piwik-table">
|
55 |
+
<thead>
|
56 |
+
<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'); ?></tr>
|
57 |
+
</thead>
|
58 |
+
<tbody>
|
59 |
+
<?php
|
60 |
+
$aryTmp = array_reverse($aryConf['data']['Visitors']);
|
61 |
+
foreach ($aryTmp as $strDate => $intValue)
|
62 |
+
echo '<tr><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>';
|
63 |
+
unset($aryTmp);
|
64 |
+
?>
|
65 |
+
</tbody>
|
66 |
+
</table>
|
67 |
+
</div>
|
68 |
+
<?php include ('footer.php');
|
dashboard/websites.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$aryConf['data'] = $this->call_API(
|
3 |
+
'Referers.getWebsites',
|
4 |
+
$aryConf['params']['period'],
|
5 |
+
$aryConf['params']['date'],
|
6 |
+
$aryConf['params']['limit']
|
7 |
+
);
|
8 |
+
$aryConf['title'] = __('Websites', 'wp-piwik');
|
9 |
+
include('header.php');
|
10 |
+
?>
|
11 |
+
<table class="widefat">
|
12 |
+
<thead>
|
13 |
+
<tr><th><?php _e('Website', 'wp-piwik'); ?></th><th><?php _e('Unique', 'wp-piwik'); ?></th></tr>
|
14 |
+
</thead>
|
15 |
+
<tbody>
|
16 |
+
<?php
|
17 |
+
foreach ($aryConf['data'] as $aryValues)
|
18 |
+
echo '<tr><td>'.$aryValues['label'].'</td><td>'.$aryValues['nb_uniq_visitors'].'</td></tr>';
|
19 |
+
?>
|
20 |
+
</tbody>
|
21 |
+
</table>
|
22 |
+
<?php include('footer.php'); ?>
|
js/wp-piwik.js
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
jQuery( function($) {
|
3 |
+
|
4 |
+
// close postboxes that should be closed
|
5 |
+
jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
|
6 |
+
postboxes.add_postbox_toggles('wppiwik');
|
7 |
+
} );
|
languages/wp-piwik-de_DE.mo
ADDED
Binary file
|
languages/wp-piwik-de_DE.po
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# WP-Piwik 0.3.0 - German language file
|
2 |
+
# Copyright (C) 2009 Andre Braekling
|
3 |
+
# This file is distributed under the same license as the WP-Piwik package.
|
4 |
+
# Andre Braekling <webmaster@braekling.de>, 2009.
|
5 |
+
#
|
6 |
+
msgid ""
|
7 |
+
msgstr ""
|
8 |
+
"Project-Id-Version: 0.3.0\n"
|
9 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-piwik\n"
|
10 |
+
"POT-Creation-Date: 2009-06-09 19:05+0000\n"
|
11 |
+
"PO-Revision-Date: 2009-06-09 20:05+0000\n"
|
12 |
+
"Last-Translator: Andre Braekling <webmaster@braekling.de>\n"
|
13 |
+
"Language-Team: German <webmaster@braekling.de>\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
|
18 |
+
#: dashboard/browsers.php:8 dashboard/browsers.php:37
|
19 |
+
msgid "Browser"
|
20 |
+
msgstr "Browser"
|
21 |
+
|
22 |
+
#: dashboard/browsers.php:37 dashboard/keywords.php:13
|
23 |
+
#: dashboard/visitors.php:56 dashboard/websites.php:13
|
24 |
+
msgid "Unique"
|
25 |
+
msgstr "Unique"
|
26 |
+
|
27 |
+
#: dashboard/browsers.php:37
|
28 |
+
msgid "Percent"
|
29 |
+
msgstr "Prozent"
|
30 |
+
|
31 |
+
#: dashboard/keywords.php:8
|
32 |
+
msgid "Keywords"
|
33 |
+
msgstr "Keywords"
|
34 |
+
|
35 |
+
#: dashboard/keywords.php:13
|
36 |
+
msgid "Keyword"
|
37 |
+
msgstr "Keyword"
|
38 |
+
|
39 |
+
#: dashboard/overview.php:8
|
40 |
+
msgid "Overview"
|
41 |
+
msgstr "Übersicht"
|
42 |
+
|
43 |
+
#: dashboard/overview.php:16 dashboard/visitors.php:21
|
44 |
+
msgid "Visitors"
|
45 |
+
msgstr "Besucher"
|
46 |
+
|
47 |
+
#: dashboard/overview.php:17
|
48 |
+
msgid "Unique visitors"
|
49 |
+
msgstr "Eindeutige Besucher"
|
50 |
+
|
51 |
+
#: dashboard/overview.php:18
|
52 |
+
msgid "Page views"
|
53 |
+
msgstr "Pageviews"
|
54 |
+
|
55 |
+
#: dashboard/overview.php:19
|
56 |
+
msgid "Max. page views in one visit"
|
57 |
+
msgstr "Max. Pageviews/Besuch"
|
58 |
+
|
59 |
+
#: dashboard/overview.php:20
|
60 |
+
msgid "Total time spent by visitors"
|
61 |
+
msgstr "Zeit aller Besucher"
|
62 |
+
|
63 |
+
#: dashboard/overview.php:21
|
64 |
+
msgid "Bounce count"
|
65 |
+
msgstr "Sofortige Absprünge"
|
66 |
+
|
67 |
+
#: dashboard/visitors.php:56
|
68 |
+
msgid "Date"
|
69 |
+
msgstr "Datum"
|
70 |
+
|
71 |
+
#: dashboard/visitors.php:56
|
72 |
+
msgid "Visits"
|
73 |
+
msgstr "Visits"
|
74 |
+
|
75 |
+
#: dashboard/visitors.php:56
|
76 |
+
msgid "Bounced"
|
77 |
+
msgstr "Absprünge"
|
78 |
+
|
79 |
+
#: dashboard/websites.php:8
|
80 |
+
msgid "Websites"
|
81 |
+
msgstr "Webseiten"
|
82 |
+
|
83 |
+
#: dashboard/websites.php:13
|
84 |
+
msgid "Website"
|
85 |
+
msgstr "Webseite"
|
86 |
+
|
87 |
+
#: wp-piwik.php:49 wp-piwik.php:147
|
88 |
+
msgid "Piwik Statistics"
|
89 |
+
msgstr "Piwik Statistiken"
|
90 |
+
|
91 |
+
#. #-#-#-#-# plugin.pot (PACKAGE VERSION) #-#-#-#-#
|
92 |
+
#. Plugin Name of an extension
|
93 |
+
#: wp-piwik.php:49
|
94 |
+
msgid "WP-Piwik"
|
95 |
+
msgstr "WP-Piwik"
|
96 |
+
|
97 |
+
#: wp-piwik.php:53 wp-piwik.php:185
|
98 |
+
msgid "WP-Piwik Settings"
|
99 |
+
msgstr "WP-Piwik Einstellungen"
|
100 |
+
|
101 |
+
#: wp-piwik.php:59
|
102 |
+
msgid "Settings"
|
103 |
+
msgstr "Einstellungen"
|
104 |
+
|
105 |
+
#: wp-piwik.php:190
|
106 |
+
msgid "Account settings"
|
107 |
+
msgstr "Account-Konfiguration"
|
108 |
+
|
109 |
+
#: wp-piwik.php:192
|
110 |
+
msgid "Piwik URL"
|
111 |
+
msgstr "Piwik URL"
|
112 |
+
|
113 |
+
#: wp-piwik.php:196
|
114 |
+
msgid "Auth token"
|
115 |
+
msgstr "Auth token"
|
116 |
+
|
117 |
+
#: wp-piwik.php:200
|
118 |
+
msgid ""
|
119 |
+
"To enable Piwik statistics, please enter your Piwik base URL (like http://"
|
120 |
+
"mydomain.com/piwik) and your personal authentification token. You can get "
|
121 |
+
"the token on the API page inside your Piwik interface. It looks like "
|
122 |
+
""1234a5cd6789e0a12345b678cd9012ef"."
|
123 |
+
msgstr "Um Piwik Statistiken abrufen zu können, musst Du die URL zu Deiner Piwik-Installation "
|
124 |
+
"(z.B. http://mydomain.com/piwik) und deinen persönlichen Authentifizierungs-Schüssel (Token) "
|
125 |
+
"angeben. Du findest den Token auf der API-Seite in Deinem Piwik-Interface. Er sieht z.B. so aus: "
|
126 |
+
""1234a5cd6789e0a12345b678cd9012ef"."
|
127 |
+
|
128 |
+
#: wp-piwik.php:205 wp-piwik.php:207
|
129 |
+
msgid "An error occured"
|
130 |
+
msgstr "Ein Fehler ist aufgetreten"
|
131 |
+
|
132 |
+
#: wp-piwik.php:205
|
133 |
+
msgid ""
|
134 |
+
"Please check URL and auth token. You need at least view access to one site."
|
135 |
+
msgstr ""
|
136 |
+
"Bitte überprüfe die URL und den Token. Du benötigst zumindest View-Zugriff auf eine erfasste Seite."
|
137 |
+
|
138 |
+
#: wp-piwik:php:215
|
139 |
+
msgid "Choose site"
|
140 |
+
msgstr "Seite wählen"
|
141 |
+
|
142 |
+
#: wp-piwik.php:221
|
143 |
+
msgid ""
|
144 |
+
"If your template uses wp_footer(), WP-Piwik can automatically add the Piwik "
|
145 |
+
"javascript code to your blog."
|
146 |
+
msgstr "Wenn Dein Template wp_footer() benutzt, kann WP-Piwik den Piwik "
|
147 |
+
"JavaScript-Code automatisch in Dein Blog einfügen."
|
148 |
+
|
149 |
+
#: wp-piwik.php:226
|
150 |
+
msgid "Add script to wp_footer()"
|
151 |
+
msgstr "Skript zu wp_footer() hinzufügen"
|
152 |
+
|
153 |
+
#: wp-piwik.php:229
|
154 |
+
msgid "Save settings"
|
155 |
+
msgstr "Einstellungen speichern"
|
156 |
+
|
157 |
+
#. Plugin URI of an extension
|
158 |
+
msgid "http://dev.braekling.de/wordpress-plugins/dev/wp-piwik/index.html"
|
159 |
+
msgstr "http://dev.braekling.de/wordpress-plugins/dev/wp-piwik/index.html"
|
160 |
+
|
161 |
+
#. Description of an extension
|
162 |
+
msgid ""
|
163 |
+
"Adds Piwik stats to your dashboard menu and Piwik code to your wordpress "
|
164 |
+
"footer."
|
165 |
+
msgstr "Fügt Piwik-Statistiken zu Deinem Dashboard-Menü hinzu und "
|
166 |
+
"kann den Piwik-Tracking-Code in den Blog-Footer einfügen."
|
167 |
+
|
168 |
+
#. Author of an extension
|
169 |
+
msgid "André Bräkling"
|
170 |
+
msgstr "André Bräkling"
|
171 |
+
|
172 |
+
#. Author URI of an extension
|
173 |
+
msgid "http://www.braekling.de"
|
174 |
+
msgstr "http://www.braekling.de"
|
readme.txt
CHANGED
@@ -1,20 +1,24 @@
|
|
1 |
=== WP-Piwik ===
|
2 |
Contributors: braekling
|
3 |
Requires at least: 2.7
|
4 |
-
Tested up to: 2.7
|
5 |
-
Stable tag: 0.
|
|
|
6 |
Tags: statistics, stats, analytics, piwik
|
7 |
|
8 |
This plugin adds a piwik stats site to your WordPress dashboard.
|
9 |
|
10 |
== Description ==
|
11 |
-
This plugin adds a Piwik stats site to your WordPress dashboard.
|
12 |
|
13 |
You need a running Piwik installation and at least view access to your stats.
|
14 |
|
15 |
Look at the [Piwik website](http://piwik.org/) to get further information about Piwik.
|
16 |
|
17 |
-
This plugin is not created or provided by the Piwik project team
|
|
|
|
|
|
|
18 |
|
19 |
== Installation ==
|
20 |
1. Upload the full `wp-piwik` directory into your `wp-content/plugins` directory.
|
@@ -25,5 +29,5 @@ This plugin is not created or provided by the Piwik project team.
|
|
25 |
|
26 |
== Screenshots ==
|
27 |
|
28 |
-
1. WP-Piwik stats page.
|
29 |
2. WP-Piwik settings.
|
1 |
=== WP-Piwik ===
|
2 |
Contributors: braekling
|
3 |
Requires at least: 2.7
|
4 |
+
Tested up to: 2.7.1
|
5 |
+
Stable tag: 0.3.0
|
6 |
+
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6046779
|
7 |
Tags: statistics, stats, analytics, piwik
|
8 |
|
9 |
This plugin adds a piwik stats site to your WordPress dashboard.
|
10 |
|
11 |
== Description ==
|
12 |
+
This plugin adds a Piwik stats site to your WordPress dashboard. It's also able to add the Piwik tracking code to your blog using wp_footer.
|
13 |
|
14 |
You need a running Piwik installation and at least view access to your stats.
|
15 |
|
16 |
Look at the [Piwik website](http://piwik.org/) to get further information about Piwik.
|
17 |
|
18 |
+
*This plugin is not created or provided by the Piwik project team.*
|
19 |
+
|
20 |
+
License: GNU General Public License Version 3, 29 June 2007
|
21 |
+
Languages: English, German
|
22 |
|
23 |
== Installation ==
|
24 |
1. Upload the full `wp-piwik` directory into your `wp-content/plugins` directory.
|
29 |
|
30 |
== Screenshots ==
|
31 |
|
32 |
+
1. WP-Piwik stats page.
|
33 |
2. WP-Piwik settings.
|
wp-piwik.php
CHANGED
@@ -1,13 +1,12 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
|
4 |
Plugin Name: WP-Piwik
|
5 |
|
6 |
Plugin URI: http://dev.braekling.de/wordpress-plugins/dev/wp-piwik/index.html
|
7 |
|
8 |
Description: Adds Piwik stats to your dashboard menu and Piwik code to your wordpress footer.
|
9 |
|
10 |
-
Version: 0.
|
11 |
Author: André Bräkling
|
12 |
Author URI: http://www.braekling.de
|
13 |
|
@@ -31,8 +30,15 @@ Author URI: http://www.braekling.de
|
|
31 |
class wp_piwik {
|
32 |
|
33 |
function __construct() {
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
register_activation_hook(__FILE__, array($this, 'install'));
|
35 |
add_action('admin_menu', array($this, 'build_menu'));
|
|
|
36 |
if (get_option('wp-piwik_addjs') == 1)
|
37 |
add_action('wp_footer', array($this, 'footer'));
|
38 |
}
|
@@ -46,120 +52,134 @@ class wp_piwik {
|
|
46 |
}
|
47 |
|
48 |
function build_menu() {
|
49 |
-
add_dashboard_page(__('Piwik Statistics'), __('WP-Piwik'), 8, __FILE__, array($this, 'show_stats'));
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
|
53 |
-
function
|
54 |
-
|
55 |
-
$strURL = get_option('wp-piwik_url');
|
56 |
-
$intSite = get_option('wp-piwik_siteid');
|
57 |
-
if (empty($strToken) || empty($strURL)) return array('result' => 'error', 'message' => 'Piwik base URL or auth token not set.');
|
58 |
-
if (substr($strURL, -1, 1) != '/') $strURL .= '/';
|
59 |
-
$strURL .= '?module=API&method='.$strMethod;
|
60 |
-
$strURL .= '&idSite='.$intSite.'&period='.$strPeriod.'&date='.$strDate;
|
61 |
-
$strURL .= '&format=PHP&filter_limit='.$intLimit;
|
62 |
-
$strURL .= '&token_auth='.$strToken;
|
63 |
-
$strResult = file_get_contents($strURL);
|
64 |
-
$aryData = unserialize($strResult);
|
65 |
-
return $aryData;
|
66 |
}
|
67 |
|
68 |
-
function
|
69 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
$
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
echo '<div class="inside">';
|
94 |
-
|
95 |
-
if (!empty($aryError)) {
|
96 |
-
foreach ($aryError as $strEMessage)
|
97 |
-
echo '<p><strong>'.__('An error occured').': </strong> '.$strError.'</p>';
|
98 |
-
echo '<p><a href="options-general.php?page=wp-piwik/wp-piwik.php">'.__('Settings').'</a></p>';
|
99 |
-
} else {
|
100 |
-
echo '<table class="layout">';
|
101 |
-
echo '<tr><td>';
|
102 |
-
$strValues = $strLabels = $strValuesU = '';
|
103 |
-
$intMax = max($aryVisitors);
|
104 |
-
while ($intMax % 10 != 0 || $intMax == 0) $intMax++;
|
105 |
-
$intStep = $intMax / 5;
|
106 |
-
while ($intStep % 10 != 0 && $intStep != 1) $intStep--;
|
107 |
-
|
108 |
-
foreach ($aryVisitors as $strDate => $intValue) {
|
109 |
-
$strValues .= round($intValue/($intMax/100),2).',';
|
110 |
-
if (isset($aryUVisitors[$strDate])) $strValuesU .= round($aryUVisitors[$strDate]/($intMax/100),2).',';
|
111 |
-
$strLabels .= '|'.substr($strDate,-2);
|
112 |
-
}
|
113 |
-
$strValues = substr($strValues, 0, -1);
|
114 |
-
$strValuesU = substr($strValuesU, 0, -1);
|
115 |
-
$strGraph = 'http://chart.apis.google.com/chart?';
|
116 |
-
$strGraph .= 'cht=lc&';
|
117 |
-
$strGraph .= 'chg=0,'.round($intStep/($intMax/100),2).',2,2&';
|
118 |
-
$strGraph .= 'chs=450x220&';
|
119 |
-
$strGraph .= 'chd=t:'.$strValues.'|'.$strValuesU.'&';
|
120 |
-
$strGraph .= 'chxl=0:'.$strLabels.'&';
|
121 |
-
$strGraph .= 'chco=90AAD9,A0BAE9&';
|
122 |
-
$strGraph .= 'chm=B,D4E2ED,0,1,0|B,E4F2FD,1,2,0&';
|
123 |
-
$strGraph .= 'chxt=x,y&';
|
124 |
-
$strGraph .= 'chxr=1,0,'.$intMax.','.$intStep;
|
125 |
-
echo '<img src="'.$strGraph.'" width="450" height="220" alt="Visits graph" /><br /><br />';
|
126 |
-
echo '<table class="widefat">';
|
127 |
-
echo '<thead><tr><th>'.__('Date').'</th><th>'.__('Visits').'</th><th>'.__('Unique').'</th></tr></thead>';
|
128 |
-
echo '<tbody>';
|
129 |
-
$aryTmp = array_reverse($aryVisitors);
|
130 |
-
foreach ($aryTmp as $strDate => $intValue)
|
131 |
-
echo '<tr><td>'.$strDate.'</td><td>'.$intValue.'</td><td>'.$aryUVisitors[$strDate].'</td></tr>';
|
132 |
-
unset($aryTmp);
|
133 |
-
echo '</tbody></table>';
|
134 |
-
echo '</td><td style="width:10px;"></td><td>';
|
135 |
-
echo '<table class="widefat">';
|
136 |
-
echo '<thead><tr><th colspan="2">'.__('Overview').'</th></tr></thead>';
|
137 |
-
$strTime = floor($aryOverview['sum_visit_length']/3600).'h '.floor(($aryOverview['sum_visit_length'] % 3600)/60).'m '.floor(($aryOverview['sum_visit_length'] % 3600) % 60).'s';
|
138 |
-
echo '<tbody>';
|
139 |
-
echo '<tr><td>'.__('Visitors').':</td><td>'.$aryOverview['nb_visits'].'</td></tr>';
|
140 |
-
echo '<tr><td>'.__('Unique visitors').':</td><td>'.$aryOverview['nb_uniq_visitors'].'</td></tr>';
|
141 |
-
echo '<tr><td>'.__('Page views').':</td><td>'.$aryOverview['nb_actions'].'</td></tr>';
|
142 |
-
echo '<tr><td>'.__('Max. page views in one visit').':</td><td>'.$aryOverview['max_actions'].'</td></tr>';
|
143 |
-
echo '<tr><td>'.__('Total time spent by the visitors').':</td><td>'.$strTime.'</td></tr>';
|
144 |
-
echo '<tr><td>'.__('Bounce count').':</td><td>'.$aryOverview['bounce_count'].'</td></tr>';
|
145 |
-
echo '</tbody></table><br />';
|
146 |
-
echo '<table class="widefat">';
|
147 |
-
echo '<thead><tr><th>'.__('Keyword').'</th><th>'.__('Unique visitors').'</th></tr></thead>';
|
148 |
-
echo '<tbody>';
|
149 |
-
foreach ($aryKeywords as $aryValues)
|
150 |
-
echo '<tr><td>'.$aryValues['label'].'</td><td>'.$aryValues['nb_uniq_visitors'].'</td></tr>';
|
151 |
-
echo '</tbody></table><br />';
|
152 |
-
echo '<table class="widefat">';
|
153 |
-
echo '<thead><tr><th>'.__('Website').'</th><th>'.__('Unique visitors').'</th></tr></thead>';
|
154 |
-
echo '<tbody>';
|
155 |
-
foreach ($aryWebsites as $aryValues)
|
156 |
-
echo '<tr><td>'.$aryValues['label'].'</td><td>'.$aryValues['nb_uniq_visitors'].'</td></tr>';
|
157 |
-
echo '</tbody></table>';
|
158 |
-
echo '</td></tr>';
|
159 |
-
echo '</table>';
|
160 |
}
|
161 |
-
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
}
|
164 |
|
165 |
function show_settings() {
|
@@ -168,31 +188,31 @@ class wp_piwik {
|
|
168 |
$intSite = get_option('wp-piwik_siteid');
|
169 |
?>
|
170 |
<div class="wrap">
|
171 |
-
<h2><?php _e('WP-Piwik Settings') ?></h2>
|
172 |
<div class="inside">
|
173 |
<form method="post" action="options.php">
|
174 |
<?php wp_nonce_field('update-options'); ?>
|
175 |
<table class="form-table">
|
176 |
-
<tr><td colspan="2"><h3><?php _e('Account settings'); ?></h3></td></tr>
|
177 |
<tr>
|
178 |
-
<td><?php _e('Piwik URL'); ?>:</td>
|
179 |
<td><input type="text" name="wp-piwik_url" id="wp-piwik_url" value="<?php echo $strURL; ?>" /></td>
|
180 |
</tr>
|
181 |
<tr>
|
182 |
-
<td><?php _e('Auth token'); ?>:</td>
|
183 |
<td><input type="text" name="wp-piwik_token" id="wp-piwik_token" value="<?php echo $strToken; ?>" /></td>
|
184 |
</tr>
|
185 |
|
186 |
-
<tr><td colspan="2"><span class="setting-description"><?php _e('To enable Piwik statistics, please enter your Piwik base URL (like http://mydomain.com/piwik) and your personal authentification token. You can get the token on the API page inside your Piwik interface. It looks like "1234a5cd6789e0a12345b678cd9012ef".'); ?></span></td></tr>
|
187 |
<?php
|
188 |
if (!empty($strToken) && !empty($strURL)) {
|
189 |
$aryData = $this->call_API('SitesManager.getSitesWithAtLeastViewAccess');
|
190 |
if (empty($aryData)) {
|
191 |
-
echo '<tr><td colspan="2"><p><strong>'.__('An error occured').': </strong>'.__('Please check URL and auth token. You need at least view access to one site.').'</p></td></tr>';
|
192 |
} elseif ($aryData['result'] == 'error') {
|
193 |
-
echo '<tr><td colspan="2"><p><strong>'.__('An error occured').': </strong>'.$aryData['message'].'</p></td></tr>';
|
194 |
} else {
|
195 |
-
echo '<tr><td>Choose site:</td><td><select name="wp-piwik_siteid" id="wp-piwik_siteid">';
|
196 |
foreach ($aryData as $arySite) {
|
197 |
echo '<option value="'.$arySite['idsite'].'"'.($arySite['idsite']==$intSite?' selected':'').'>'.htmlentities($arySite['name'], ENT_QUOTES, 'utf-8').'</option>';
|
198 |
}
|
@@ -203,8 +223,8 @@ class wp_piwik {
|
|
203 |
$strJavaScript = $this->call_API('SitesManager.getJavascriptTag');
|
204 |
if ($intAddJS) update_option('wp-piwik_jscode', $strJavaScript);
|
205 |
echo '<tr><td>JavaScript:</td><td><textarea readonly rows="17" cols="80">'.($strJavaScript).'</textarea></td></tr>';
|
206 |
-
echo '<tr><td>Add script to wp_footer():</td><td><input type="checkbox" value="1" name="wp-piwik_addjs" '.($intAddJS?' checked':'').'/></td></tr>';
|
207 |
-
echo '<tr><td colspan="2"><span class="setting-description">'.__('If your template uses wp_footer(), WP-Piwik can automatically add the Piwik javascript code to your blog.').'</span></td></tr>';
|
208 |
}
|
209 |
}
|
210 |
?>
|
@@ -212,7 +232,7 @@ class wp_piwik {
|
|
212 |
<input type="hidden" name="action" value="update" />
|
213 |
<input type="hidden" name="page_options" value="wp-piwik_token,wp-piwik_url,wp-piwik_siteid,wp-piwik_addjs" />
|
214 |
<p class="submit">
|
215 |
-
<input type="submit" name="Submit" value="<?php _e('Save settings') ?>" />
|
216 |
</p>
|
217 |
</form>
|
218 |
</div>
|
1 |
<?php
|
2 |
/*
|
|
|
3 |
Plugin Name: WP-Piwik
|
4 |
|
5 |
Plugin URI: http://dev.braekling.de/wordpress-plugins/dev/wp-piwik/index.html
|
6 |
|
7 |
Description: Adds Piwik stats to your dashboard menu and Piwik code to your wordpress footer.
|
8 |
|
9 |
+
Version: 0.3.0
|
10 |
Author: André Bräkling
|
11 |
Author URI: http://www.braekling.de
|
12 |
|
30 |
class wp_piwik {
|
31 |
|
32 |
function __construct() {
|
33 |
+
$strLocale = get_locale();
|
34 |
+
if ( !empty( $strLocale ) ) {
|
35 |
+
$strMOfile = ABSPATH . 'wp-content/plugins/'.basename(dirname(__FILE__)).'/languages/wp-piwik-'.$strLocale.'.mo';
|
36 |
+
load_textdomain('wp-piwik', $strMOfile);
|
37 |
+
}
|
38 |
+
|
39 |
register_activation_hook(__FILE__, array($this, 'install'));
|
40 |
add_action('admin_menu', array($this, 'build_menu'));
|
41 |
+
add_filter('plugin_row_meta', array($this, 'set_plugin_meta', 10, 2));
|
42 |
if (get_option('wp-piwik_addjs') == 1)
|
43 |
add_action('wp_footer', array($this, 'footer'));
|
44 |
}
|
52 |
}
|
53 |
|
54 |
function build_menu() {
|
55 |
+
$intPage = add_dashboard_page(__('Piwik Statistics', 'wp-piwik'), __('WP-Piwik', 'wp-piwik'), 8, __FILE__, array($this, 'show_stats'));
|
56 |
+
add_action('admin_print_scripts-'.$intPage, array($this, 'load_scripts'));
|
57 |
+
add_action('admin_head-'.$intPage, array($this, 'add_admin_header'));
|
58 |
+
|
59 |
+
add_options_page(__('WP-Piwik Settings', 'wp-piwik'), __('WP-Piwik Settings', 'wp-piwik'), 8, __FILE__, array($this, 'show_settings'));
|
60 |
+
}
|
61 |
+
|
62 |
+
function set_plugin_meta($strLinks, $strFile) {
|
63 |
+
$strPlugin = plugin_basename(__FILE__);
|
64 |
+
if ($strFile == $strPlugin)
|
65 |
+
return array_merge($strLinks, array( sprintf( '<a href="options-general.php?page=%s">%s</a>', $strPlugin, __('Settings', 'wp-piwik') ) ));
|
66 |
+
return $strLinks;
|
67 |
+
}
|
68 |
+
|
69 |
+
function load_scripts() {
|
70 |
+
wp_enqueue_script('wp-piwik', $this->get_plugin_url().'js/wp-piwik.js', array( 'jquery', 'admin-comments', 'postbox' ));
|
71 |
+
}
|
72 |
+
|
73 |
+
function add_admin_header() {
|
74 |
+
echo '<link rel="stylesheet" href="'.$this->get_plugin_url().'css/wp-piwik.css" type="text/css"/>';
|
75 |
}
|
76 |
|
77 |
+
function get_plugin_url() {
|
78 |
+
return trailingslashit(WP_CONTENT_URL.'/plugins/'.plugin_basename(dirname(__FILE__)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
|
81 |
+
function call_API($strMethod, $strPeriod='', $strDate='', $intLimit='') {
|
82 |
+
$strKey = $strMethod.'_'.$strPeriod.'_'.$strDate.'_'.$intLimit;
|
83 |
+
if (empty($this->aryCache[$strKey])) {
|
84 |
+
$strToken = get_option('wp-piwik_token');
|
85 |
+
$strURL = get_option('wp-piwik_url');
|
86 |
+
$intSite = get_option('wp-piwik_siteid');
|
87 |
+
if (empty($strToken) || empty($strURL)) {
|
88 |
+
$this->aryCache[$key] = array(
|
89 |
+
'result' => 'error',
|
90 |
+
'message' => 'Piwik base URL or auth token not set.'
|
91 |
+
);
|
92 |
+
return $this->aryCache[$strKey];
|
93 |
+
}
|
94 |
+
if (substr($strURL, -1, 1) != '/') $strURL .= '/';
|
95 |
+
$strURL .= '?module=API&method='.$strMethod;
|
96 |
+
$strURL .= '&idSite='.$intSite.'&period='.$strPeriod.'&date='.$strDate;
|
97 |
+
$strURL .= '&format=PHP&filter_limit='.$intLimit;
|
98 |
+
$strURL .= '&token_auth='.$strToken;
|
99 |
+
$strResult = file_get_contents($strURL);
|
100 |
+
$this->aryCache[$strKey] = unserialize($strResult);
|
101 |
+
}
|
102 |
+
return $this->aryCache[$strKey];
|
103 |
+
}
|
104 |
|
105 |
+
function create_dashboard_widget($strFile, $aryConfig) {
|
106 |
+
foreach ($aryConfig['params'] as $strParam) {
|
107 |
+
if (!empty($strParam)) {
|
108 |
+
$strDesc .= $strParam.', ';
|
109 |
+
$strID .= '_'.$strParam;
|
110 |
+
}
|
111 |
+
}
|
112 |
+
$strFile = str_replace('.', '', $strFile);
|
113 |
|
114 |
+
$aryConf = array_merge($aryConfig, array(
|
115 |
+
'id' => $strFile.$strID,
|
116 |
+
'desc' => substr($strDesc, 0, -2)));
|
117 |
+
$strRoot = dirname(__FILE__);
|
118 |
+
if (file_exists($strRoot.DIRECTORY_SEPARATOR.'dashboard/'.$strFile.'.php'))
|
119 |
+
include($strRoot.DIRECTORY_SEPARATOR.'dashboard/'.$strFile.'.php');
|
120 |
+
}
|
121 |
|
122 |
+
function show_stats() {
|
123 |
+
$arySortOrder = get_user_option('meta-box-order_wppiwik');
|
124 |
+
$aryClosed = get_user_option('closedpostboxes_wppiwik');
|
125 |
+
if (empty($aryClosed)) $aryClosed = array();
|
126 |
+
|
127 |
+
$aryDashboard = array();
|
128 |
+
if (!$arySortOrder) {
|
129 |
+
// Set default configuration
|
130 |
+
$arySortOrder = array(
|
131 |
+
'side' => 'overview_day_yesterday,keywords_day_yesterday_10,websites_day_yesterday_10',
|
132 |
+
'normal' => 'visitors_day_last30,browsers_day_yesterday'
|
133 |
+
);
|
134 |
+
|
135 |
+
update_user_option($GLOBALS['current_user']->ID, 'meta-box-order_wppiwik', $arySortOrder);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
}
|
137 |
+
foreach ($arySortOrder as $strCol => $strWidgets) {
|
138 |
+
$aryWidgets = explode(',', $strWidgets);
|
139 |
+
if (is_array($aryWidgets)) foreach ($aryWidgets as $strParams) {
|
140 |
+
$aryParams = explode('_', $strParams);
|
141 |
+
$aryDashboard[$strCol][$aryParams[0]] = array(
|
142 |
+
'params' => array(
|
143 |
+
'period' => (isset($aryParams[1])?$aryParams[1]:''),
|
144 |
+
'date' => (isset($aryParams[2])?$aryParams[2]:''),
|
145 |
+
'limit' => (isset($aryParams[3])?$aryParams[3]:'')
|
146 |
+
),
|
147 |
+
'closed' => (in_array($strParams, $aryClosed))
|
148 |
+
);
|
149 |
+
}
|
150 |
+
}
|
151 |
+
?>
|
152 |
+
<div class="wrap"><div id="icon-post" class="icon32"><br /></div>
|
153 |
+
<h2><?php _e('Piwik Statistics', 'wp-piwik'); ?></h2>
|
154 |
+
<div id="wppiwik-widgets-wrap">
|
155 |
+
<div id="wppiwik-widgets" class="metabox-holder">
|
156 |
+
<div id="side-info-column" class="inner-sidebar wp-piwik-side">
|
157 |
+
<div id="side-sortables" class="meta-box-sortables">
|
158 |
+
<?php
|
159 |
+
foreach ($aryDashboard['side'] as $strFile => $aryConfig)
|
160 |
+
$this->create_dashboard_widget($strFile, $aryConfig);
|
161 |
+
?>
|
162 |
+
</div>
|
163 |
+
</div>
|
164 |
+
<div id='post-body' class="has-sidebar">
|
165 |
+
<div id='wppiwik-widgets-main-content' class='has-sidebar-content'>
|
166 |
+
<div id='normal-sortables' class='meta-box-sortables'>
|
167 |
+
<?php
|
168 |
+
foreach ($aryDashboard['normal'] as $strFile => $aryConfig)
|
169 |
+
$this->create_dashboard_widget($strFile, $aryConfig);
|
170 |
+
wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
|
171 |
+
wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
|
172 |
+
?>
|
173 |
+
|
174 |
+
<div class="clear"></div>
|
175 |
+
</div><!-- wppiwik-widgets-wrap -->
|
176 |
+
|
177 |
+
</div>
|
178 |
+
</div>
|
179 |
+
</div>
|
180 |
+
</div>
|
181 |
+
</div>
|
182 |
+
<?php
|
183 |
}
|
184 |
|
185 |
function show_settings() {
|
188 |
$intSite = get_option('wp-piwik_siteid');
|
189 |
?>
|
190 |
<div class="wrap">
|
191 |
+
<h2><?php _e('WP-Piwik Settings', 'wp-piwik') ?></h2>
|
192 |
<div class="inside">
|
193 |
<form method="post" action="options.php">
|
194 |
<?php wp_nonce_field('update-options'); ?>
|
195 |
<table class="form-table">
|
196 |
+
<tr><td colspan="2"><h3><?php _e('Account settings', 'wp-piwik'); ?></h3></td></tr>
|
197 |
<tr>
|
198 |
+
<td><?php _e('Piwik URL', 'wp-piwik'); ?>:</td>
|
199 |
<td><input type="text" name="wp-piwik_url" id="wp-piwik_url" value="<?php echo $strURL; ?>" /></td>
|
200 |
</tr>
|
201 |
<tr>
|
202 |
+
<td><?php _e('Auth token', 'wp-piwik'); ?>:</td>
|
203 |
<td><input type="text" name="wp-piwik_token" id="wp-piwik_token" value="<?php echo $strToken; ?>" /></td>
|
204 |
</tr>
|
205 |
|
206 |
+
<tr><td colspan="2"><span class="setting-description"><?php _e('To enable Piwik statistics, please enter your Piwik base URL (like http://mydomain.com/piwik) and your personal authentification token. You can get the token on the API page inside your Piwik interface. It looks like "1234a5cd6789e0a12345b678cd9012ef".', 'wp-piwik'); ?></span></td></tr>
|
207 |
<?php
|
208 |
if (!empty($strToken) && !empty($strURL)) {
|
209 |
$aryData = $this->call_API('SitesManager.getSitesWithAtLeastViewAccess');
|
210 |
if (empty($aryData)) {
|
211 |
+
echo '<tr><td colspan="2"><p><strong>'.__('An error occured', 'wp-piwik').': </strong>'.__('Please check URL and auth token. You need at least view access to one site.', 'wp-piwik').'</p></td></tr>';
|
212 |
} elseif ($aryData['result'] == 'error') {
|
213 |
+
echo '<tr><td colspan="2"><p><strong>'.__('An error occured', 'wp-piwik').': </strong>'.$aryData['message'].'</p></td></tr>';
|
214 |
} else {
|
215 |
+
echo '<tr><td>'.__('Choose site', 'wp-piwik').':</td><td><select name="wp-piwik_siteid" id="wp-piwik_siteid">';
|
216 |
foreach ($aryData as $arySite) {
|
217 |
echo '<option value="'.$arySite['idsite'].'"'.($arySite['idsite']==$intSite?' selected':'').'>'.htmlentities($arySite['name'], ENT_QUOTES, 'utf-8').'</option>';
|
218 |
}
|
223 |
$strJavaScript = $this->call_API('SitesManager.getJavascriptTag');
|
224 |
if ($intAddJS) update_option('wp-piwik_jscode', $strJavaScript);
|
225 |
echo '<tr><td>JavaScript:</td><td><textarea readonly rows="17" cols="80">'.($strJavaScript).'</textarea></td></tr>';
|
226 |
+
echo '<tr><td>'.__('Add script to wp_footer()', 'wp-piwik').':</td><td><input type="checkbox" value="1" name="wp-piwik_addjs" '.($intAddJS?' checked':'').'/></td></tr>';
|
227 |
+
echo '<tr><td colspan="2"><span class="setting-description">'.__('If your template uses wp_footer(), WP-Piwik can automatically add the Piwik javascript code to your blog.', 'wp-piwik').'</span></td></tr>';
|
228 |
}
|
229 |
}
|
230 |
?>
|
232 |
<input type="hidden" name="action" value="update" />
|
233 |
<input type="hidden" name="page_options" value="wp-piwik_token,wp-piwik_url,wp-piwik_siteid,wp-piwik_addjs" />
|
234 |
<p class="submit">
|
235 |
+
<input type="submit" name="Submit" value="<?php _e('Save settings', 'wp-piwik') ?>" />
|
236 |
</p>
|
237 |
</form>
|
238 |
</div>
|