Commit 0462d3a1 authored by lucha's avatar lucha

[auto] plugin: wp-piwik 1.0.19

parent b3d4de4b
......@@ -12,7 +12,7 @@ class WP_Piwik {
*
* @var Runtime environment variables
*/
private static $revisionId = 2017080901, $version = '1.0.17', $blog_id, $pluginBasename = NULL, $logger, $settings, $request, $optionsPageId;
private static $revisionId = 2017101501, $version = '1.0.19', $blog_id, $pluginBasename = NULL, $logger, $settings, $request, $optionsPageId;
/**
* Constructor class to configure and register all WP-Piwik components
......@@ -478,6 +478,8 @@ class WP_Piwik {
) );
if (self::$settings->getGlobalOption ( 'dashboard_chart' ))
new WP_Piwik\Widget\Chart ( $this, self::$settings );
if (self::$settings->getGlobalOption ( 'dashboard_ecommerce' ))
new WP_Piwik\Widget\Ecommerce ( $this, self::$settings );
if (self::$settings->getGlobalOption ( 'dashboard_seo' ))
new WP_Piwik\Widget\Seo ( $this, self::$settings );
}
......@@ -1023,7 +1025,6 @@ class WP_Piwik {
* attribute list
*/
public function shortcode($attributes) {
load_plugin_textdomain ( 'wp-piwik', false, 'wp-piwik' . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR );
shortcode_atts ( array (
'title' => '',
'module' => 'overview',
......@@ -1224,6 +1225,11 @@ class WP_Piwik {
new \WP_Piwik\Widget\Chart ( $this, self::$settings, $this->statsPageId );
new \WP_Piwik\Widget\Visitors ( $this, self::$settings, $this->statsPageId );
new \WP_Piwik\Widget\Overview ( $this, self::$settings, $this->statsPageId );
if (self::$settings->getGlobalOption ( 'stats_ecommerce' )) {
new \WP_Piwik\Widget\Ecommerce ($this, self::$settings, $this->statsPageId);
new \WP_Piwik\Widget\Items ($this, self::$settings, $this->statsPageId);
new \WP_Piwik\Widget\ItemsCategory ($this, self::$settings, $this->statsPageId);
}
if (self::$settings->getGlobalOption ( 'stats_seo' ))
new \WP_Piwik\Widget\Seo ( $this, self::$settings, $this->statsPageId );
new \WP_Piwik\Widget\Pages ( $this, self::$settings, $this->statsPageId );
......
......@@ -162,6 +162,7 @@ class Settings extends \WP_Piwik\Admin {
), __ ( 'Default date shown on statistics page.', 'wp-piwik' ) );
$this->showCheckbox ( 'stats_seo', __ ( 'Show SEO data', 'wp-piwik' ), __ ( 'Display SEO ranking data on statistics page.', 'wp-piwik' ) . ' (' . __ ( 'Slow!', 'wp-piwik' ) . ')' );
$this->showCheckbox ( 'stats_ecommerce', __ ( 'Show e-commerce data', 'wp-piwik' ), __ ( 'Display e-commerce data on statistics page.', 'wp-piwik' ) );
$this->showSelect ( 'dashboard_widget', __ ( 'Dashboard overview', 'wp-piwik' ), array (
'disabled' => __ ( 'Disabled', 'wp-piwik' ),
......@@ -174,6 +175,8 @@ class Settings extends \WP_Piwik\Admin {
$this->showCheckbox ( 'dashboard_seo', __ ( 'Dashboard SEO', 'wp-piwik' ), __ ( 'Enable WP-Piwik dashboard widget "SEO".', 'wp-piwik' ) . ' (' . __ ( 'Slow!', 'wp-piwik' ) . ')' );
$this->showCheckbox ( 'dashboard_ecommerce', __ ( 'Dashboard e-commerce', 'wp-piwik' ), __ ( 'Enable WP-Piwik dashboard widget "E-commerce".', 'wp-piwik' ) );
$this->showCheckbox ( 'toolbar', __ ( 'Show graph on WordPress Toolbar', 'wp-piwik' ), __ ( 'Display a last 30 days visitor graph on WordPress\' toolbar.', 'wp-piwik' ) );
echo '<tr><th scope="row"><label for="capability_read_stats">' . __ ( 'Display stats to', 'wp-piwik' ) . '</label>:</th><td>';
......
......@@ -104,7 +104,7 @@ class Sitebrowser extends \WP_List_Table {
private function showSearchForm() {
?>
<form method="post">
<input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
<input type="hidden" name="page" value="<?php echo filter_var($_REQUEST['page'], FILTER_SANITIZE_STRING) ?>" />
<?php $this->search_box('Search domain and path', 'wpPiwikSiteSearch'); ?>
</form>
<?php
......
......@@ -46,7 +46,9 @@ class Settings {
// User settings: Stats configuration
'default_date' => 'yesterday',
'stats_seo' => false,
'stats_ecommerce' => false,
'dashboard_widget' => false,
'dashboard_ecommerce' => false,
'dashboard_chart' => false,
'dashboard_seo' => false,
'toolbar' => false,
......
<?php
namespace WP_Piwik\Widget;
class Ecommerce extends \WP_Piwik\Widget {
public $className = __CLASS__;
protected function configure($prefix = '', $params = array()) {
$timeSettings = $this->getTimeSettings();
$this->title = $prefix.__('E-Commerce', 'wp-piwik');
$this->method = 'Goals.get';
$this->parameter = array(
'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
'period' => $timeSettings['period'],
'date' => $timeSettings['date']
);
}
public function show() {
$response = self::$wpPiwik->request($this->apiID[$this->method]);
if (!empty($response['result']) && $response['result'] ='error')
echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($response['message'], ENT_QUOTES, 'utf-8');
else {
$tableHead = null;
$tableBody = array(
array(__('Conversions', 'wp-piwik').':', $this->value($response, 'nb_conversions')),
array(__('Visits converted', 'wp-piwik').':', $this->value($response, 'nb_visits_converted')),
array(__('Revenue', 'wp-piwik').':', number_format($this->value($response, 'revenue'),2)),
array(__('Conversion rate', 'wp-piwik').':', $this->value($response, 'conversion_rate')),
array(__('Conversions (new visitor)', 'wp-piwik').':', $this->value($response, 'nb_conversions_new_visit')),
array(__('Visits converted (new visitor)', 'wp-piwik').':', $this->value($response, 'nb_visits_converted_new_visit')),
array(__('Revenue (new visitor)', 'wp-piwik').':', number_format($this->value($response, 'revenue_new_visit'),2)),
array(__('Conversion rate (new visitor)', 'wp-piwik').':', $this->value($response, 'conversion_rate_new_visit')),
array(__('Conversions (returning visitor)', 'wp-piwik').':', $this->value($response, 'nb_conversions_returning_visit')),
array(__('Visits converted (returning visitor)', 'wp-piwik').':', $this->value($response, 'nb_visits_converted_returning_visit')),
array(__('Revenue (returning visitor)', 'wp-piwik').':', number_format($this->value($response, 'revenue_returning_visit'),2)),
array(__('Conversion rate (returning visitor)', 'wp-piwik').':', $this->value($response, 'conversion_rate_returning_visit')),
);
$tableFoot = (self::$settings->getGlobalOption('piwik_shortcut')?array(__('Shortcut', 'wp-piwik').':', '<a href="'.self::$settings->getGlobalOption('piwik_url').'">Piwik</a>'.(isset($aryConf['inline']) && $aryConf['inline']?' - <a href="?page=wp-piwik_stats">WP-Piwik</a>':'')):null);
$this->table($tableHead, $tableBody, $tableFoot);
}
}
}
\ No newline at end of file
<?php
namespace WP_Piwik\Widget;
class Items extends \WP_Piwik\Widget {
public $className = __CLASS__;
protected function configure($prefix = '', $params = array()) {
$timeSettings = $this->getTimeSettings();
$this->title = $prefix.__('E-Commerce Items', 'wp-piwik');
$this->method = 'Goals.getItemsName';
$this->parameter = array(
'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
'period' => $timeSettings['period'],
'date' => $timeSettings['date']
);
}
public function show() {
$response = self::$wpPiwik->request($this->apiID[$this->method]);
if (!empty($response['result']) && $response['result'] ='error')
echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($response['message'], ENT_QUOTES, 'utf-8');
else {
$tableHead = array(
__('Label', 'wp-piwik'),
__('Revenue', 'wp-piwik'),
__('Quantity', 'wp-piwik'),
__('Orders', 'wp-piwik'),
__('Avg. price', 'wp-piwik'),
__('Avg. quantity', 'wp-piwik'),
__('Conversion rate', 'wp-piwik'),
);
$tableBody = array();
if (is_array($response))
foreach ($response as $data) {
array_push($tableBody, array(
$data['label'],
number_format($data['revenue'],2),
$data['quantity'],
$data['orders'],
number_format($data['avg_price'],2),
$data['avg_quantity'],
$data['conversion_rate']
));
}
$tableFoot = array();
$this->table($tableHead, $tableBody, $tableFoot);
}
}
}
\ No newline at end of file
<?php
namespace WP_Piwik\Widget;
class ItemsCategory extends \WP_Piwik\Widget {
public $className = __CLASS__;
protected function configure($prefix = '', $params = array()) {
$timeSettings = $this->getTimeSettings();
$this->title = $prefix.__('E-Commerce Item Categories', 'wp-piwik');
$this->method = 'Goals.getItemsCategory';
$this->parameter = array(
'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
'period' => $timeSettings['period'],
'date' => $timeSettings['date']
);
}
public function show() {
$response = self::$wpPiwik->request($this->apiID[$this->method]);
if (!empty($response['result']) && $response['result'] ='error')
echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($response['message'], ENT_QUOTES, 'utf-8');
else {
$tableHead = array(
__('Label', 'wp-piwik'),
__('Revenue', 'wp-piwik'),
__('Quantity', 'wp-piwik'),
__('Orders', 'wp-piwik'),
__('Avg. price', 'wp-piwik'),
__('Avg. quantity', 'wp-piwik'),
__('Conversion rate', 'wp-piwik'),
);
$tableBody = array();
if (is_array($response))
foreach ($response as $data) {
array_push($tableBody, array(
$data['label'],
isset($data['revenue'])?number_format($data['revenue'],2):"-.--",
isset($data['quantity'])?$data['quantity']:'-',
isset($data['orders'])?$data['orders']:'-',
number_format($data['avg_price'],2),
$data['avg_quantity'],
$data['conversion_rate']
));
}
$tableFoot = array();
$this->table($tableHead, $tableBody, $tableFoot);
}
}
}
\ No newline at end of file
......@@ -2,8 +2,8 @@
Contributors: Braekling
Requires at least: 4.0
Tested up to: 4.8.1
Stable tag: 1.0.17
Tested up to: 4.8.2
Stable tag: 1.0.19
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6046779
Tags: piwik, tracking, statistics, stats, analytics
......@@ -141,6 +141,14 @@ Add WP-Piwik to your /wp-content/plugins folder and enable it as [Network Plugin
== Changelog ==
= 1.0.19 =
* Security fix: Escape request var
* Language updates
= 1.0.18 =
* WPML.org support: Use different site IDs for different languages
* Ecommerce widgets
= 1.0.17 =
* Header issue solved which caused incompatibilities with other plugins like Yoast SEO
* Update of InnoCraft cloud links (InnoCraft is the team behind Piwik)
......
......@@ -6,11 +6,11 @@ Plugin URI: http://wordpress.org/extend/plugins/wp-piwik/
Description: Adds Piwik statistics to your WordPress dashboard and is also able to add the Piwik Tracking Code to your blog.
Version: 1.0.17
Version: 1.0.19
Author: Andr&eacute; Br&auml;kling
Author URI: http://www.braekling.de
Text Domain: wp-piwik
Domain Path: /languages/
Domain Path: /languages
License: GPL3
******************************************************************************************
......@@ -61,8 +61,10 @@ function wp_piwik_phperror() {
echo '</p></div>';
}
if (is_admin())
load_plugin_textdomain ( 'wp-piwik', false, 'wp-piwik' . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR );
function wp_piwik_load_textdomain() {
load_plugin_textdomain( 'wp-piwik', false, plugin_basename( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR );
}
add_action( 'plugins_loaded', 'wp_piwik_load_textdomain' );
if (version_compare ( PHP_VERSION, '5.3.0', '<' ))
add_action ( 'admin_notices', 'wp_piwik_phperror' );
......
<wpml-config>
<admin-texts>
<key name="wp-piwik-site_id" />
</admin-texts>
</wpml-config>
\ No newline at end of file
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