Skip to content

Commit

Permalink
Merge pull request #10974 from piwik/3.x-dev
Browse files Browse the repository at this point in the history
Release Piwik 3.0.0-rc1
  • Loading branch information
mattab authored Dec 6, 2016
2 parents 46eafa8 + d96661e commit b1c09fa
Show file tree
Hide file tree
Showing 37 changed files with 555 additions and 271 deletions.
2 changes: 1 addition & 1 deletion core/Translation/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function translate($translationId, $args = array(), $language = null)
}

if (count($args) == 0) {
return $translationId;
return str_replace('%%', '%', $translationId);
}
return vsprintf($translationId, $args);
}
Expand Down
2 changes: 1 addition & 1 deletion core/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class Version
* The current Piwik version.
* @var string
*/
const VERSION = '3.0.0-b5';
const VERSION = '3.0.0-rc1';

public function isStableVersion($version)
{
Expand Down
2 changes: 1 addition & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"ColumnPageBounceRateDocumentation": "The percentage of visits that started on this page and left the website straight away.",
"ColumnPageviews": "Pageviews",
"ColumnPageviewsDocumentation": "The number of times this page was visited.",
"ColumnPercentageVisits": "% Visits",
"ColumnPercentageVisits": "%% Visits",
"ColumnRevenue": "Revenue",
"ColumnSumVisitLength": "Total time spent by visitors (in seconds)",
"ColumnTotalPageviews": "Total Pageviews",
Expand Down
2 changes: 1 addition & 1 deletion plugins/API/templates/listAllAPI.twig
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div piwik-content-block content-title="{{ 'API_UserAuthentication'|translate|e('html_attr') }}">
<p>
{{ 'API_UsingTokenAuth'|translate('','',"")|raw }}<br/>
<pre piwik-select-on-focus id='token_auth'>&amp;token_auth=<strong>{{ token_auth }}</strong></pre><br/>
<pre piwik-select-on-focus id='token_auth'>&amp;token_auth=<strong piwik-show-sensitive-data="{{ token_auth }}" data-click-element-selector="#token_auth"></strong></pre><br/>
{{ 'API_KeepTokenSecret'|translate('<b>','</b>')|raw }}<br />
{{ 'API_ChangeTokenHint'|translate('<a href="' ~ linkTo({
'module': 'UsersManager',
Expand Down
2 changes: 1 addition & 1 deletion plugins/Actions/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"ColumnSearchCategory": "Search Category",
"ColumnSearches": "Searches",
"ColumnSearchesDocumentation": "The number of visits that searched for this keyword on your website's search engine.",
"ColumnSearchExits": "% Search Exits",
"ColumnSearchExits": "%% Search Exits",
"ColumnSearchExitsDocumentation": "The percentage of visits that left the website after searching for this Keyword on your Site Search engine.",
"ColumnSearchResultsCount": "Search Results Count",
"ColumnSiteSearchKeywords": "Unique Keywords",
Expand Down
1 change: 1 addition & 0 deletions plugins/CoreAdminHome/templates/home.twig
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
{% endif %}

{% if isMarketplaceEnabled %}
<div piwik-widget-loader='{"module":"Marketplace","action":"getPremiumFeatures"}'></div>
<div piwik-widget-loader='{"module":"Marketplace","action":"getNewPlugins", "isAdminPage": "1"}'></div>
{% endif %}

Expand Down
2 changes: 2 additions & 0 deletions plugins/CoreHome/CoreHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public function getJsFiles(&$jsFiles)
$jsFiles[] = "plugins/CoreHome/angularjs/common/directives/directive.module.js";
$jsFiles[] = "plugins/CoreHome/angularjs/common/directives/attributes.js";
$jsFiles[] = "plugins/CoreHome/angularjs/common/directives/field-condition.js";
$jsFiles[] = "plugins/CoreHome/angularjs/common/directives/show-sensitive-data.js";
$jsFiles[] = "plugins/CoreHome/angularjs/common/directives/autocomplete-matched.js";
$jsFiles[] = "plugins/CoreHome/angularjs/common/directives/focus-anywhere-but-here.js";
$jsFiles[] = "plugins/CoreHome/angularjs/common/directives/ignore-click.js";
Expand Down Expand Up @@ -255,6 +256,7 @@ public function getClientSideTranslationKeys(&$translationKeys)
$translationKeys[] = 'General_MultiSitesSummary';
$translationKeys[] = 'General_SearchNoResults';
$translationKeys[] = 'CoreHome_ChooseX';
$translationKeys[] = 'CoreHome_ClickToSeeFullInformation';
$translationKeys[] = 'CoreHome_YouAreUsingTheLatestVersion';
$translationKeys[] = 'CoreHome_IncludeRowsWithLowPopulation';
$translationKeys[] = 'CoreHome_ExcludeRowsWithLowPopulation';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*!
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/

/**
* Handles visibility of sensitive data. By default data will be shown replaced with stars (*)
* On click on the element the full data will be shown
*
* Configuration attributes:
* data-show-characters number of characters to show in clear text (defaults to 6)
* data-click-element-selector selector for element that will show the full data on click (defaults to element)
*
* Example:
* <div piwik-show-sensitive-date="some text"></div>
*/
(function () {
angular.module('piwikApp.directive').directive('piwikShowSensitiveData', piwikShowSensitiveData);

function piwikShowSensitiveData(){
return {
restrict: 'A',
link: function(scope, element, attr) {

var sensitiveData = attr.piwikShowSensitiveData || attr.text();
var showCharacters = attr.showCharacters || 6;
var clickElement = attr.clickElementSelector || element;

var protectedData = '';
if (showCharacters > 0) {
protectedData += sensitiveData.substr(0, showCharacters);
}
protectedData += sensitiveData.substr(showCharacters).replace(/./g, '*');
element.html(protectedData);

function onClickHandler(event) {
element.html(sensitiveData);
$(clickElement).css({
cursor: ''
});
$(clickElement).tooltip("destroy");
}

$(clickElement).tooltip({
content: _pk_translate('CoreHome_ClickToSeeFullInformation'),
items: '*',
track: true
});

$(clickElement).one('click', onClickHandler);
$(clickElement).css({
cursor: 'pointer'
})
}
};
}
})();
1 change: 1 addition & 0 deletions plugins/CoreHome/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"CheckForUpdates": "Check for updates",
"CheckPiwikOut": "Check Piwik out!",
"ClickToEditX": "Click to edit %s",
"ClickToSeeFullInformation": "Click to see the full information",
"CloseSearch": "Close search",
"CloseWidgetDirections": "You can close this widget by clicking on the 'X' icon at the top of the widget.",
"ChooseX": "Choose %1$s",
Expand Down
2 changes: 1 addition & 1 deletion plugins/CoreHome/templates/getSystemSummary.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</div>
<div>
<span>{{ 'CoreHome_SystemSummaryPiwikVersion'|translate }}:</span>
<span>{{ piwikVersion }}</span>
<span class="piwik-version">{{ piwikVersion }}</span>
</div>
<div>
<span>{{ 'CoreHome_SystemSummaryMysqlVersion'|translate }}:</span>
Expand Down
2 changes: 1 addition & 1 deletion plugins/CustomAlerts
4 changes: 2 additions & 2 deletions plugins/Installation/templates/getSystemCheckWidget.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% endif %}

{% if numErrors %}
<p class="system-errors"><span class="icon-error"></span> {{ 'General_Errors'|translate }}:</p>
<p class="system-errors"><span class="icon-error"></span> {{ 'General_Errors'|translate }}</p>
<ul>
{% for error in errors %}
<li title="{{ error.getLongErrorMessage|e('html_attr') }}">{{ error.getLabel }}</li>
Expand All @@ -20,7 +20,7 @@
<br />
{% endif %}

<span class="icon-warning"></span> {{ 'General_Warnings'|translate }}:
<span class="icon-warning"></span> {{ 'General_Warnings'|translate }}
</p>
<ul>
{% for warning in warnings %}
Expand Down
26 changes: 26 additions & 0 deletions plugins/LanguagesManager/Test/Integration/LanguagesManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,32 @@ function testTranslationsUseNumberedPlaceholders()
}
}

/**
* check all english translations do not contain unescaped % symbols
*
* @group Plugins
* @group numbered2
*/
function testTranslationsUseEscapedPercentSigns()
{
Cache::flushAll();
$translator = StaticContainer::get('Piwik\Translation\Translator');
$translator->reset();
Translate::loadAllTranslations();
$translations = $translator->getAllTranslations();
foreach ($translations AS $plugin => $pluginTranslations) {
if ($plugin == 'Intl') {
continue; // skip generated stuff
}
foreach ($pluginTranslations as $key => $pluginTranslation) {
$pluginTranslation = preg_replace('/(%(?:[1-9]\$)?[a-z])/', '', $pluginTranslation); // remove placeholders
$pluginTranslation = str_replace('%%', '', $pluginTranslation); // remove already escaped symbols
$this->assertEquals(0, substr_count($pluginTranslation, '%'),
sprintf('%s.%s must use escaped %% symbols', $plugin, $key));
}
}
}

/**
* test English short name for language
*
Expand Down
3 changes: 2 additions & 1 deletion plugins/Marketplace/Widgets/GetNewPlugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Piwik\Common;
use Piwik\Plugins\Marketplace\Api\Client;
use Piwik\Plugins\Marketplace\Input\PurchaseType;
use Piwik\Plugins\Marketplace\Input\Sort;
use Piwik\Widget\Widget;
use Piwik\Widget\WidgetConfig;
Expand Down Expand Up @@ -43,7 +44,7 @@ public function render()
$template = 'getNewPlugins';
}

$plugins = $this->marketplaceApiClient->searchForPlugins('', '', Sort::METHOD_LAST_UPDATED, '');
$plugins = $this->marketplaceApiClient->searchForPlugins('', '', Sort::METHOD_LAST_UPDATED, PurchaseType::TYPE_ALL);

return $this->renderTemplate($template, array(
'plugins' => array_splice($plugins, 0, 3)
Expand Down
56 changes: 56 additions & 0 deletions plugins/Marketplace/Widgets/GetPremiumFeatures.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\Marketplace\Widgets;

use Piwik\Common;
use Piwik\Piwik;
use Piwik\Plugin;
use Piwik\Plugins\Marketplace\Api\Client;
use Piwik\Plugins\Marketplace\Input\PurchaseType;
use Piwik\Plugins\Marketplace\Input\Sort;
use Piwik\Widget\Widget;
use Piwik\Widget\WidgetConfig;

class GetPremiumFeatures extends Widget
{
/**
* @var Client
*/
private $marketplaceApiClient;

public function __construct(Client $marketplaceApiClient)
{
$this->marketplaceApiClient = $marketplaceApiClient;
}

public static function configure(WidgetConfig $config)
{
$config->setCategoryId('About Piwik');
$config->setName(Piwik::translate('Marketplace_PaidPlugins'));
$config->setOrder(20);
}

public function render()
{
$template = 'getPremiumFeatures';

$plugins = $this->marketplaceApiClient->searchForPlugins('', '', Sort::METHOD_LAST_UPDATED, PurchaseType::TYPE_PAID);

if (empty($plugins)) {
$plugins = array();
} else {
$plugins = array_splice($plugins, 0, 20);
}

return $this->renderTemplate($template, array(
'plugins' => $plugins
));
}

}
19 changes: 19 additions & 0 deletions plugins/Marketplace/stylesheets/marketplace-widget.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
}
}

.getPremiumFeatures {
h3 {
margin-top: 0;
}
.pluginBody {
margin-bottom: 32px;
display: inline-block;

.pluginMoreDetails {
line-height:3em;
}
}

.row {
margin-left: -12px;
margin-right: -12px;
}
}

.getNewPlugins {
.pluginName {
cursor: pointer;
Expand Down
4 changes: 2 additions & 2 deletions plugins/Marketplace/templates/getNewPlugins.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% for plugin in plugins %}
<div class="col s12">

<h3 class="pluginName" piwik-plugin-name="{{ plugin.name|e('html_attr') }}">{{ plugin.name }}</h3>
<h3 class="pluginName" piwik-plugin-name="{{ plugin.name|e('html_attr') }}">{{ plugin.displayName }}</h3>
<span>
{{ plugin.description }}
<br />
Expand All @@ -16,7 +16,7 @@
</div>

<div class="widgetBody">
<a href="{{ linkTo({'module': 'CorePluginsAdmin', 'action': 'marketplace'}) }}"
<a href="{{ linkTo({'module': 'Marketplace', 'action': 'overview'}) }}"
>{{ 'CorePluginsAdmin_ViewAllMarketplacePlugins'|translate }}</a>
</div>
</div>
4 changes: 2 additions & 2 deletions plugins/Marketplace/templates/getNewPluginsAdmin.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<h3 class="pluginName"
title="{{ plugin.description|e('html_attr') }}"
piwik-plugin-name="{{ plugin.name|e('html_attr') }}">{{ plugin.name }}</h3>
piwik-plugin-name="{{ plugin.name|e('html_attr') }}">{{ plugin.displayName }}</h3>
<p class="description"
title="{{ plugin.description|e('html_attr') }}">{{ plugin.description }}</p>

Expand All @@ -20,7 +20,7 @@
</div>

<div class="widgetBody">
<a href="{{ linkTo({'module': 'CorePluginsAdmin', 'action': 'marketplace'}) }}"
<a href="{{ linkTo({'module': 'Marketplace', 'action': 'overview'}) }}"
>{{ 'CorePluginsAdmin_ViewAllMarketplacePlugins'|translate }}</a>
</div>

Expand Down
23 changes: 23 additions & 0 deletions plugins/Marketplace/templates/getPremiumFeatures.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<div class="getNewPlugins getPremiumFeatures widgetBody">
<div class="row">
{% for plugin in plugins %}
<div class="col s12 m4">

<h3 class="pluginName" piwik-plugin-name="{{ plugin.name|e('html_attr') }}">{{ plugin.displayName }}</h3>
<span class="pluginBody">
{{ plugin.description }}
<br />
<a href="javascript:;" class="pluginMoreDetails" piwik-plugin-name="{{ plugin.name|e('html_attr') }}">{{ 'General_MoreDetails'|translate }}</a>
</span>
</div>
{% if loop.index % 3 == 0 %}
</div><div class="row">
{% endif %}
{% endfor %}
</div>

<div class="widgetBody">
<a href="{{ linkTo({'module': 'Marketplace', 'action': 'overview', 'show': 'premium'}) }}"
>{{ 'CorePluginsAdmin_ViewAllMarketplacePlugins'|translate }}</a>
</div>
</div>
23 changes: 1 addition & 22 deletions plugins/SegmentEditor/javascripts/Segmentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -1278,28 +1278,7 @@ $(document).ready(function() {
segmentDefinition = cleanupSegmentDefinition(segmentDefinition);
segmentDefinition = encodeURIComponent(segmentDefinition);

if (piwikHelper.isAngularRenderingThePage()) {

angular.element(document).injector().invoke(function ($location, $rootScope) {
var $search = $location.search();

if (segmentDefinition !== $search.segment) {
// eg when using back button the date might be actually already changed in the URL and we do not
// want to change the URL again
$search.segment = segmentDefinition.replace(/%$/, '%25').replace(/%([^\d].)/g, "%25$1");
$location.search($search);
setTimeout(function () {
try {
$rootScope.$apply();
} catch (e) {}
}, 1);
}

});
return false;
} else {
return broadcast.propagateNewPage('segment=' + segmentDefinition, true);
}
return broadcast.propagateNewPage('segment=' + segmentDefinition, true);
};

this.changeSegmentList = function () {};
Expand Down
Loading

0 comments on commit b1c09fa

Please sign in to comment.