Skip to content

Commit

Permalink
Merge pull request #361 from matomo-org/develop
Browse files Browse the repository at this point in the history
Update live for 1.3.1 release
  • Loading branch information
tsteur authored Oct 15, 2020
2 parents 13ab903 + 9b82256 commit 2d57792
Show file tree
Hide file tree
Showing 25 changed files with 270 additions and 111 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/README.md export-ignore
/.wordpress-org export-ignore
/.github export-ignore
.github export-ignore
.gitignore export-ignore
.gitattributes export-ignore
.travis.yml export-ignore
Expand Down
7 changes: 7 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# These are supported funding model platforms

patreon: matomo
open_collective: matomo-analytics
ko_fi: matomo
liberapay: Matomo
custom: ['https://www.paypal.com/donate/?hosted_button_id=RPL23NJURMTFA']
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
== Changelog ==

= 1.3.1 =
* Log less messages by default
* Add possibility to disable logging and enable logging of all messages through wp-config.php
* Make sure jQuery URLs use correct protocol
* Optimise order of tracking settings
* Show a warning in system report if MS Edge 85+ is used
* Add more information to system report
* Other minor fixes

= 1.3.0 =
* Changed opt out shortcode to no longer use an iframe and instead print the content directly
* Automatically use a primary key for log tmp table when required
Expand Down
71 changes: 20 additions & 51 deletions app/plugins/CoreHome/templates/_donate.twig
Original file line number Diff line number Diff line change
@@ -1,58 +1,27 @@
<div class="piwik-donate-call">
<div class="piwik-donate-call ng-scope">
<div class="piwik-donate-message">
{% if msg is defined %}
{{ msg }}
{% else %}
<p>{{ 'CoreHome_DonateCall1'|translate }}</p>
<p><strong>{{ 'CoreHome_DonateCall2'|translate }}</strong></p>
<p>{{ 'CoreHome_DonateCall3'|translate('<strong>','</strong>', '<a target="_blank" rel="nofollow" href="https://matomo.org/recommends/premium-plugins/"><strong>', '</strong></a>')|raw }}</p>
{% endif %}
<p>Matomo will always cost you nothing to use, but that doesn't mean it costs us nothing to make.</p>
<p><strong>Matomo needs your continued support to grow and thrive.</strong></p>
<p>If you feel that Matomo has added significant value to your business or endeavour, <strong>please consider donating</strong> or <a target="_blank" rel="nofollow" href="https://matomo.org/recommends/premium-plugins/"><strong>purchasing a premium feature</strong></a>. Every penny will help.</p>
</div>

<span id="piwik-worth">{{ 'CoreHome_HowMuchIsPiwikWorth'|translate }}</span>
<span id="piwik-worth" style="margin: 1em 1em 0.5em 0;">Find us on</span>

<div class="donate-form-instructions">({{ 'CoreHome_DonateFormInstructions'|translate }})</div>
<ul class="browser-default">
<li style="list-style-type: disc;margin-left: 15px;"><a href="https://www.patreon.com/matomo" target="_blank" rel="noreferrer noopener">Patreon</a></li>
<li style="list-style-type: disc;margin-left: 15px;"><a href="https://ko-fi.com/matomo" target="_blank" rel="noreferrer noopener">Ko-fi</a></li>
<li style="list-style-type: disc;margin-left: 15px;"><a href="https://liberapay.com/Matomo" target="_blank" rel="noreferrer noopener">Liberapay</a></li>
<li style="list-style-type: disc;margin-left: 15px;"><a href="https://opencollective.com/matomo-analytics" target="_blank" rel="noreferrer noopener">Open Collective</a></li>
<li style="list-style-type: disc;margin-left: 15px;"><a href="https://www.paypal.com/donate/?cmd=_s-xclick&amp;hosted_button_id=RPL23NJURMTFA" target="_blank" rel="noreferrer noopener">PayPal</a></li>
</ul>

<form action="index.php?module=CoreHome&action=redirectToPaypal&idSite=1" method="post" target="_blank">
<div class="piwik-donate-slider">
<div class="slider-range">
<div class="slider-position"></div>
</div>
<div style="display:inline-block;float:right;">
<div class="slider-donate-amount">$30/{{ 'Intl_Year_Short'|translate }}</div>
<p style="margin-top: 1em;">
Your donation will directly help fund new features and improvements for this open-source analytics platform. This means the community will always benefit from a tool that protects privacy and lets you stay in control of your data.
<br><br>
<strong>Thank you from all of us at Matomo!</strong>
</p>

<img class="slider-smiley-face" width="40" height="40" src="plugins/Morpheus/images/smileyprog_1.png"/>
</div>
<div class="form-description">

<input type="hidden" name="os0" value="Option 1"/>
</div>

<div class="donate-submit">
<input type="image" src="plugins/Morpheus/images/paypal_subscribe.png" border="0" name="submit"
title="{{ 'CoreHome_SubscribeAndBecomePiwikSupporter'|translate }}"/>
<a class="donate-spacer">{{ 'CoreHome_MakeOneTimeDonation'|translate }}</a>
<a href="index.php?module=CoreHome&action=redirectToPaypal&idSite=1&onetime=true"
rel="noreferrer noopener" target="_blank" class="donate-one-time">{{ 'CoreHome_MakeOneTimeDonation'|translate }}</a>
</div>

<!-- to cache images -->
<img style="display:none;" src="plugins/Morpheus/images/smileyprog_0.png"/>
<img style="display:none;" src="plugins/Morpheus/images/smileyprog_1.png"/>
<img style="display:none;" src="plugins/Morpheus/images/smileyprog_2.png"/>
<img style="display:none;" src="plugins/Morpheus/images/smileyprog_3.png"/>
<img style="display:none;" src="plugins/Morpheus/images/smileyprog_4.png"/>
</form>
{% if footerMessage is defined %}
<div class="form-description">
{{ footerMessage }}
</div>
{% endif %}
</div>
<script type="text/javascript">
$(document).ready(function () {
// Note: this will cause problems if more than one donate form is on the page
$('.piwik-donate-slider').each(function () {
$(this).trigger('piwik:changePosition', {position: 1});
});
});
</script>
</div>
</div>
6 changes: 2 additions & 4 deletions app/plugins/TagManager/Template/Tag/MatomoTag.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@
lastMatomoUrl = getMatomoUrlFromConfig(matomoConfig);
var trackerUrl = lastMatomoUrl + matomoConfig.trackingEndpoint;
if (matomoConfig.registerAsDefaultTracker) {
tracker = Piwik.addTracker(trackerUrl);
tracker = Piwik.addTracker(trackerUrl, matomoConfig.idSite);
} else {
tracker = Piwik.getTracker(trackerUrl);
tracker = Piwik.getTracker(trackerUrl, matomoConfig.idSite);
}
configuredTrackers[variableName] = tracker;

Expand Down Expand Up @@ -155,8 +155,6 @@
tracker.setDomains(domains);
}

tracker.setSiteId(matomoConfig.idSite);

if (matomoConfig.alwaysUseSendBeacon) {
tracker.alwaysUseSendBeacon();
}
Expand Down
2 changes: 1 addition & 1 deletion assets/js/asset_manager_core_js.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions assets/js/opt-out-configurator.directive.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="optOutCustomizer">
<p>
Use the short code <code>[matomo_opt_out]</code> to embed the opt out into your website.<br>
You can use these short code options:</p>
<ul style="margin:20px;">
<li style="list-style: disc">language - eg de or en. By default the language is detected automatically based on the user's browser</li>
</ul>
<p>Example: <code>[matomo_opt_out language=de]</code></p>
</div>
43 changes: 43 additions & 0 deletions assets/js/opt-out-configurator.directive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*!
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/

/**
* Usage:
* <div piwik-opt-out-customizer>
*/
(function () {
angular.module('piwikApp').directive('piwikOptOutCustomizer', piwikOptOutCustomizer);

piwikOptOutCustomizer.$inject = ['piwik'];

function piwikOptOutCustomizer(piwik){
var defaults = {
// showAllSitesItem: 'true'
};

return {
restrict: 'A',
scope: {
language: '@',
piwikurl: '@'
},
templateUrl: '../assets/js/opt-out-configurator.directive.html?cb=' + piwik.cacheBuster,
compile: function (element, attrs) {

for (var index in defaults) {
if (defaults.hasOwnProperty(index) && attrs[index] === undefined) {
attrs[index] = defaults[index];
}
}

return function (scope, element, attrs) {

};
}
};
}
})();
64 changes: 59 additions & 5 deletions classes/WpMatomo/Admin/SystemReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@

namespace WpMatomo\Admin;

use DeviceDetector\DeviceDetector;
use Piwik\CliMulti;
use Piwik\Common;
use Piwik\Config;
use Piwik\Container\StaticContainer;
use Piwik\Date;
use Piwik\DeviceDetector\DeviceDetectorFactory;
use Piwik\Filesystem;
use Piwik\MetricsFormatter;
use Piwik\Plugins\CoreAdminHome\API;
use Piwik\Plugins\Diagnostics\Diagnostic\DiagnosticResult;
use Piwik\Plugins\Diagnostics\DiagnosticService;
use Piwik\Plugins\UserCountry\LocationProvider;
use Piwik\Tracker\Failures;
use WpMatomo\Bootstrap;
use WpMatomo\Capabilities;
use WpMatomo\Installer;
Expand Down Expand Up @@ -199,7 +202,7 @@ public function show() {
array(
'title' => 'Browser',
'rows' => $this->get_browser_info(),
'has_comments' => false,
'has_comments' => true,
),
);
}
Expand Down Expand Up @@ -493,14 +496,15 @@ private function get_matomo_info() {
if ( ! \WpMatomo::is_safe_mode() ) {
Bootstrap::do_bootstrap();
$general = Config::getInstance()->General;

if (empty($general['proxy_client_headers'])) {
foreach (AdvancedSettings::$valid_host_headers as $header) {
if (!empty($_SERVER[$header])) {
$rows[] = array(
'name' => 'Proxy header',
'value' => $header,
'is_warning' => true,
'comment' => 'A proxy header is set which means you maybe need to configure a proxy header in the Advanced settings to make location reporting work. If the location in your reports is detected correctly, you can ignore this warning.',
'comment' => 'A proxy header is set which means you maybe need to configure a proxy header in the Advanced settings to make location reporting work. If the location in your reports is detected correctly, you can ignore this warning. Learn more: https://matomo.org/faq/wordpress/how-do-i-fix-the-proxy-header-warning-in-the-matomo-for-wordpress-system-report/',
);
}
}
Expand Down Expand Up @@ -610,6 +614,36 @@ private function get_matomo_info() {
);
}


if ( ! \WpMatomo::is_safe_mode() ) {
Bootstrap::do_bootstrap();
$trackfailures = [];
try {
$tracking_failures = new Failures();
$trackfailures = $tracking_failures->getAllFailures();
} catch (\Exception $e) {
// ignored in case not set up yet etc.
}
if (!empty($trackfailures)) {
$rows[] = array(
'section' => 'Tracking failures',
);
foreach ($trackfailures as $failure) {
$comment = sprintf('Solution: %s<br>More info: %s<br>Date: %s<br>Request URL: %s',
$failure['solution'], $failure['solution_url'],
$failure['pretty_date_first_occurred'], $failure['request_url']);
$rows[] = array(
'name' => $failure['problem'],
'is_warning' => true,
'value' => '',
'comment' => $comment,
);
}

}
}


return $rows;
}

Expand All @@ -630,7 +664,7 @@ private function had_visits_in_last_days($numDays)

try {
$time = gmdate( 'Y-m-d H:i:s', time() - $days_in_seconds );
$sql = $wpdb->prepare('SELECT count(idsite) from ' . $prefix_table . ' where visit_last_action_time > %s LIMIT 1', $time );
$sql = $wpdb->prepare('SELECT idsite from ' . $prefix_table . ' where visit_last_action_time > %s LIMIT 1', $time );
$row = $wpdb->get_var( $sql );
} catch ( \Exception $e ) {
$row = null;
Expand Down Expand Up @@ -944,14 +978,34 @@ private function get_browser_info() {
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
$rows[] = array(
'name' => 'Browser',
'value' => $_SERVER['HTTP_USER_AGENT'],
'value' => '',
'comment' => $_SERVER['HTTP_USER_AGENT']
);
}
if (!\WpMatomo::is_safe_mode()) {
Bootstrap::do_bootstrap();
try {
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
$detector = StaticContainer::get(DeviceDetectorFactory::class)->makeInstance($_SERVER['HTTP_USER_AGENT']);
$client = $detector->getClient();
if (!empty($client['name']) && $client['name'] === 'Microsoft Edge' && (int) $client['version'] >= 85) {
$rows[] = array(
'name' => 'Browser Compatibility',
'is_warning' => true,
'value' => 'Yes',
'comment' => 'Because you are using MS Edge browser, you may see a warning like "This site has been reported as unsafe" from "Microsoft Defender SmartScreen" when you view the Matomo Reporting, Admin or Tag Manager page. This is a false alert and you can safely ignore this warning by clicking on the icon next to the URL (in the address bar) and choosing either "Report as safe" (preferred) or "Show unsafe content". We are hoping to get this false warning removed in the future.'
);
}
}

} catch (\Exception $e) {

}

$rows[] = array(
'name' => 'Language',
'value' => Common::getBrowserLanguage()
'value' => Common::getBrowserLanguage(),
'comment' => ''
);
}

Expand Down
13 changes: 11 additions & 2 deletions classes/WpMatomo/Admin/TrackingSettings/Forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,17 @@ public function show_textarea( $id, $name, $rows, $description, $is_hidden, $gro
*
* @param string $text Text to show
*/
public function show_text( $text ) {
printf( '<tr><td colspan="2"><p>%s</p></td></tr>', esc_html( $text ) );
public function show_text( $text , $group_name = '' ) {
printf( '<tr class="%s"><td colspan="2"><p>%s</p></td></tr>', $group_name, esc_html( $text ) );
}

/**
* Show a simple text
*
* @param string $text Text to show
*/
public function show_headline( $text , $group_name = '') {
printf( '<tr class="%s"><td colspan="2"><h3>%s</h3></td></tr>', $group_name, esc_html( $text ) );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion classes/WpMatomo/Admin/views/advanced_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<?php
echo '<span style="white-space: nowrap;display: inline-block;"><input type="radio" ' . ( empty($matomo_client_headers) ? 'checked="checked" ' : '' ) . ' value="REMOTE_ADDR" name="matomo[proxy_client_header]" /> <code>REMOTE_ADDR</code> ' . ( ! empty( $_SERVER[ 'REMOTE_ADDR' ] ) ? esc_html( $_SERVER[ 'REMOTE_ADDR' ] ) : esc_html__( 'No value found', 'matomo' ) ) . ' (' . esc_html__( 'Default', 'matomo' ) .')</span>';
foreach ( AdvancedSettings::$valid_host_headers as $host_header ) {
echo '<span style="white-space: nowrap;display: inline-block;"><input type="radio" ' . ( in_array( $host_header, $matomo_client_headers, true ) ? 'checked="checked" ' : '' ) . 'value="'. esc_attr($host_header).'" name="matomo[proxy_client_header]" /> <code>' . $host_header . '</code> ' . ( ! empty( $_SERVER[ $host_header ] ) ? esc_html( $_SERVER[ $host_header ] ) : esc_html__( 'No value found', 'matomo' ) ) . ' &nbsp; </span>';
echo '<span style="white-space: nowrap;display: inline-block;"><input type="radio" ' . ( in_array( $host_header, $matomo_client_headers, true ) ? 'checked="checked" ' : '' ) . 'value="'. esc_attr($host_header).'" name="matomo[proxy_client_header]" /> <code>' . $host_header . '</code> ' . ( ! empty( $_SERVER[ $host_header ] ) ? ('<strong>'. esc_html( $_SERVER[ $host_header ] ) . '</strong>') : esc_html__( 'No value found', 'matomo' ) ) . ' &nbsp; </span>';
}
?>
</td>
Expand Down
5 changes: 4 additions & 1 deletion classes/WpMatomo/Admin/views/info.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
);
?>
<br/><br/>
<?php
Matomo will always cost you nothing to use, but that doesn't mean it costs us nothing to make.
Matomo needs your continued support to grow and thrive.
<?php
echo sprintf(
esc_html__(
'You can also help us by %1$sdonating%2$s or by %3$spurchasing premium plugins%4$s which fund the
Expand All @@ -53,6 +55,7 @@
'</a>'
);
?>
Every penny will help.
</p>

<?php require 'info_newsletter.php'; ?>
Expand Down
Loading

0 comments on commit 2d57792

Please sign in to comment.