Commit 4ffe9185 authored by lechuck's avatar lechuck Committed by lucha
Browse files

Upgraded WP-Piwik to 0.9.9.12

parent e4686f31
......@@ -42,6 +42,7 @@
'track_codeposition' => 'footer',
'track_datacfasync' => false,
'track_across' => false,
'track_across_alias' => false,
'limit_cookies' => false,
'limit_cookies_visitor' => 1209600,
'limit_cookies_session' => 0,
......@@ -156,7 +157,6 @@
public function checkNetworkActivation() {
if (!function_exists("is_plugin_active_for_network")) {
require_once(ABSPATH.'wp-admin/includes/plugin.php');
wp_cookie_constants();
}
return is_plugin_active_for_network('wp-piwik/wp-piwik.php');
}
......
......@@ -755,4 +755,10 @@ msgid "Track visitors across all subdomains"
msgstr "Besucher über alle Subdomains aufzeichnen"
msgid "Adds *.-prefix to cookie domain."
msgstr "Fügt ein *.-Präfix zur Cookie Domain hinzu."
\ No newline at end of file
msgstr "Fügt ein *.-Präfix zur Cookie Domain hinzu."
msgid "Track visitors across all alias URLs"
msgstr "Besucher über alle alternative URLs aufzeichnen"
msgid "Adds *.-prefix to tracked domain."
msgstr "Fügt ein *.-Präfix zur getrackten Domain hinzu."
\ No newline at end of file
......@@ -2,8 +2,8 @@
Contributors: Braekling
Requires at least: 3.8
Tested up to: 3.9
Stable tag: 0.9.9.10
Tested up to: 3.9.1
Stable tag: 0.9.9.12
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6046779
Tags: statistics, stats, analytics, piwik, wpmu
......@@ -125,13 +125,26 @@ Please update Piwik if not done yet (Piwik 2.0 or higher is recommended)!
== Changelog ==
= 0.9.9.12 =
* Bugfix: Avoid forced relogin on site change (WP network)
* Bugfix: Avoid multiple annotations on post updates
* Bugfix: User mergeSubdomains instead of mergeAliasURLs
* Feature: Added mergeAliasURLs as additional feature
= 0.9.9.11 =
* Bugfix: PHP API causes plain text output issue, see http://wordpress.org/support/topic/bug-cant-access-to-tabs-in-setting-after-configuration
* Bugfix: PHP API causes WordPress multisite login issue, see http://wordpress.org/support/topic/causes-multisite-superadmin-subsite-login-problem
* Bugfix: Removed PHP warning if annotations are enabled and annotations will work again, see http://wordpress.org/support/topic/warning-message-everywhere-in-the-backend-call_user_func_array-expects
* Feature: "Track visitors across all subdomains" script changes are done by Piwik now, see http://wordpress.org/support/topic/track-across-subdomains-wp-on-subdomain?replies=2
* Update: Flattr API update
= 0.9.9.10 =
* Bugfix: Multisite login issue, see http://wordpress.org/support/topic/0999-multisite-frontend-not-logged-in
* Bugfix: wpMandrall compatibility, see http://wordpress.org/support/topic/version-0999-conflicts-with-wpmandrill?replies=4
* Bugfix: wpMandrill compatibility, see http://wordpress.org/support/topic/version-0999-conflicts-with-wpmandrill
* Feature: Show page views (actions) in "visitors last 30"
= 0.9.9.9 =
* Update: PHP API will use namespaces (Piwik 2.x compatibility)
* Update: PHP API will use namespaces (Piwik 2.x compatibility, PHP 5.3+ required)
* Update: Piwik URL isn't necessary to use PHP API anymore.
* Feature: Limit cookie lifetime
* Feature: Track visitors across all subdomains
......
......@@ -88,6 +88,11 @@ if (self::$settings->getGlobalOption('add_tracking_code')) {
<label for="wp-piwik_track_across"><?php echo _e('Adds *.-prefix to cookie domain.', 'wp-piwik'); ?></label>
</td></tr>
<tr><th><?php _e('Track visitors across all alias URLs', 'wp-piwik'); ?>:</th><td>
<input type="checkbox" value="1" id="wp-piwik_track_across_alias" name="wp-piwik_track_across_alias"<?php echo (self::$settings->getGlobalOption('track_across_alias')?' checked="checked"':''); ?> />
<label for="wp-piwik_track_across_alias"><?php echo _e('Adds *.-prefix to tracked domain.', 'wp-piwik'); ?></label>
</td></tr>
<tr><th><?php _e('Track search', 'wp-piwik'); ?>:</th><td>
<input type="checkbox" value="1" id="wp-piwik_search" name="wp-piwik_search"<?php echo (self::$settings->getGlobalOption('track_search')?' checked="checked"':''); ?> />
<label for="wp-piwik_search"><?php echo _e('Use Piwik\'s advanced Site Search Analytics feature. See', 'wp-piwik'); ?> <a href="http://piwik.org/docs/javascript-tracking/#toc-tracking-internal-search-keywords-categories-and-no-result-search-keywords">Piwik Docs</a>.</label>
......
<?php
self::$settings->setGlobalOption('track_codeposition', footer);
\ No newline at end of file
self::$settings->setGlobalOption('track_codeposition', 'footer');
\ No newline at end of file
......@@ -6,7 +6,7 @@ Plugin URI: http://wordpress.org/extend/plugins/wp-piwik/
Description: Adds Piwik stats to your dashboard menu and Piwik code to your wordpress header.
Version: 0.9.9.10
Version: 0.9.9.12
Author: Andr&eacute; Br&auml;kling
Author URI: http://www.braekling.de
......@@ -39,8 +39,8 @@ if (!class_exists('wp_piwik')) {
class wp_piwik {
private static
$intRevisionId = 92000,
$strVersion = '0.9.9.10',
$intRevisionId = 93000,
$strVersion = '0.9.9.12',
$blog_id,
$intDashboardID = 30,
$strPluginBasename = NULL,
......@@ -103,7 +103,7 @@ class wp_piwik {
add_action('admin_head', array($this, 'addAdminHeaderTracking'));
}
if (self::$settings->getGlobalOption('add_post_annotations'))
add_action('transition_post_status', array($this, 'onPostStatusTransition'));
add_action('transition_post_status', array($this, 'onPostStatusTransition'),10,3);
}
private function addFilters() {
......@@ -672,6 +672,7 @@ class wp_piwik {
*/
function addAdminHeaderSettings() {
echo '<script type="text/javascript">var $j = jQuery.noConflict();</script>';
echo '<script type="text/javascript">/* <![CDATA[ */(function() {var s = document.createElement(\'script\');var t = document.getElementsByTagName(\'script\')[0];s.type = \'text/javascript\';s.async = true;s.src = \'//api.flattr.com/js/0.6/load.js?mode=auto\';t.parentNode.insertBefore(s, t);})();/* ]]> */</script>';
}
/**
......@@ -741,6 +742,11 @@ class wp_piwik {
return;
if (PIWIK_INCLUDE_PATH === FALSE)
return serialize(array('result' => 'error', 'message' => __('Could not resolve','wp-piwik').' &quot;'.htmlentities(self::$settings->getGlobalOption('piwik_path')).'&quot;: '.__('realpath() returns false','wp-piwik').'.'));
if (!headers_sent()) {
$current = ob_get_contents();
ob_end_clean();
ob_start();
}
if (file_exists(PIWIK_INCLUDE_PATH . "/index.php"))
require_once PIWIK_INCLUDE_PATH . "/index.php";
if (file_exists(PIWIK_INCLUDE_PATH . "/core/API/Request.php"))
......@@ -751,6 +757,11 @@ class wp_piwik {
if (class_exists('Piwik\API\Request'))
$objRequest = new Piwik\API\Request($strParams);
else serialize(array('result' => 'error', 'message' => __('Class Piwik\API\Request does not exists.','wp-piwik')));
if (!headers_sent()) {
ob_end_clean();
ob_start;
echo $current;
}
return $objRequest->process();
}
......@@ -857,10 +868,6 @@ class wp_piwik {
// Change code if POST is forced to be used
if (self::$settings->getGlobalOption('track_post') && self::$settings->getGlobalOption('track_mode') != 2) $strCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['setRequestMethod', 'POST']);\n_paq.push(['trackPageView']);", $strCode);
// Change code if cookies are disabled
if (self::$settings->getGlobalOption('track_across')) {
$referrerParsed = parse_url(get_bloginfo('url'));
$strCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['setCookieDomain', '*.".$referrerParsed['host']."']);\n_paq.push(['trackPageView']);", $strCode);
}
if (self::$settings->getGlobalOption('disable_cookies')) $strCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['disableCookies']);\n_paq.push(['trackPageView']);", $strCode);
if (self::$settings->getGlobalOption('limit_cookies')) $strCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['setVisitorCookieTimeout', '".self::$settings->getGlobalOption('limit_cookies_visitor')."']);\n_paq.push(['setSessionCookieTimeout', '".self::$settings->getGlobalOption('limit_cookies_session')."']);\n_paq.push(['trackPageView']);", $strCode);
// Store <noscript> code
......@@ -945,8 +952,14 @@ class wp_piwik {
$strURL .= '&format='.$strFormat;
$strURL .= ($strPageURL?'&pageUrl='.urlencode($strPageURL):'');
$strURL .= ($strNote?'&note='.urlencode($strNote):'');
if (self::$settings->getGlobalOption('track_across') && $strMethod == 'SitesManager.getJavascriptTag') {
$strURL .= '&mergeSubdomains=1';
}
if (self::$settings->getGlobalOption('track_across_alias') && $strMethod == 'SitesManager.getJavascriptTag') {
$strURL .= '&mergeAliasUrls=1';
}
// Fetch data if site exists
if (!empty($intSite) || $strMethod='SitesManager.getSitesWithAtLeastViewAccess') {
if (!empty($intSite) || $strMethod=='SitesManager.getSitesWithAtLeastViewAccess') {
self::$logger->log('API method: '.$strMethod.' API call: '.$strURL);
$strResult = (string) $this->getRemoteFile($strURL, get_bloginfo('url'));
$result = ($strFormat == 'PHP'?unserialize($strResult):$strResult);
......@@ -1210,6 +1223,7 @@ class wp_piwik {
self::$settings->setGlobalOption('track_feed_addcampaign', (isset($_POST['wp-piwik_trackfeed_addcampaign'])?$_POST['wp-piwik_trackfeed_addcampaign']:false));
self::$settings->setGlobalOption('track_datacfasync', (isset($_POST['wp-piwik_datacfasync'])?$_POST['wp-piwik_datacfasync']:false));
self::$settings->setGlobalOption('track_across', (isset($_POST['wp-piwik_track_across'])?$_POST['wp-piwik_track_across']:false));
self::$settings->setGlobalOption('track_across_alias', (isset($_POST['wp-piwik_track_across_alias'])?$_POST['wp-piwik_track_across_alias']:false));
self::$settings->setGlobalOption('add_post_annotations', (isset($_POST['wp-piwik_annotations'])?$_POST['wp-piwik_annotations']:false));
self::$settings->setGlobalOption('add_customvars_box', (isset($_POST['wp-piwik_customvars'])?$_POST['wp-piwik_customvars']:false));
self::$settings->setGlobalOption('capability_stealth', (isset($_POST['wp-piwik_filter'])?$_POST['wp-piwik_filter']:array()));
......@@ -1275,11 +1289,20 @@ class wp_piwik {
<div class="wp-piwik-donate">
<p><strong><?php _e('Donate','wp-piwik'); ?></strong></p>
<p><?php _e('If you like WP-Piwik, you can support its development by a donation:', 'wp-piwik'); ?></p>
<script type="text/javascript">
/* <![CDATA[ */
window.onload = function() {
FlattrLoader.render({
'uid': 'flattr',
'url': 'http://wp.local',
'title': 'Title of the thing',
'description': 'Description of the thing'
}, 'element_id', 'replace');
}
/* ]]> */
</script>
<div>
<script type="text/javascript">
var flattr_url = 'http://www.braekling.de/wp-piwik-wpmu-piwik-wordpress';
</script>
<script src="http<?php echo (self::isSSL()?'s':''); ?>://api.flattr.com/button/load.js" type="text/javascript"></script>
<a class="FlattrButton" style="display:none;" title="WordPress Plugin WP-Piwik" rel="flattr;uid:braekling;category:software;tags:wordpress,piwik,plugin,statistics;" href="https://www.braekling.de/wp-piwik-wpmu-piwik-wordpress">This WordPress 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. You need a running Piwik installation and at least view access to your stats.</a>
</div>
<div>Paypal
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
......@@ -1427,11 +1450,14 @@ class wp_piwik {
}
private static function definePiwikConstants() {
define('PIWIK_INCLUDE_PATH', self::$settings->getGlobalOption('piwik_path'));
define('PIWIK_USER_PATH', self::$settings->getGlobalOption('piwik_path'));
define('PIWIK_ENABLE_DISPATCH', false);
define('PIWIK_ENABLE_ERROR_HANDLER', false);
define('PIWIK_ENABLE_SESSION_START', false);
if (!defined('PIWIK_INCLUDE_PATH')) {
@header('Content-type: text/xml');
define('PIWIK_INCLUDE_PATH', self::$settings->getGlobalOption('piwik_path'));
define('PIWIK_USER_PATH', self::$settings->getGlobalOption('piwik_path'));
define('PIWIK_ENABLE_DISPATCH', false);
define('PIWIK_ENABLE_ERROR_HANDLER', false);
define('PIWIK_ENABLE_SESSION_START', false);
}
}
private function openLogger() {
......@@ -1490,7 +1516,7 @@ class wp_piwik {
$this->addNoscriptCode();
}
private function onPostStatusTransition($newStatus, $oldStatus = 'false', $post = null) {
public function onPostStatusTransition($newStatus, $oldStatus, $post) {
if ($newStatus == 'publish' && $oldStatus != 'publish' ) {
add_action('publish_post', array($this, 'addPiwikAnnotation'));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment