diff options
author | Matthieu Aubry <mattab@users.noreply.github.com> | 2017-02-22 17:51:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-22 17:51:28 +0300 |
commit | 146201f15d5b323786f38cb92acb61b5612b58b2 (patch) | |
tree | ab7db7996fb1ff0df3ffbe741dc68ef37e691891 | |
parent | 44694a6fc303b37d370d59c9e7bc23c6c2ae0a47 (diff) | |
parent | 340863dc35c7915075b635ee8d9bb70fa3b5b3bf (diff) |
Merge pull request #11397 from piwik/3.x-dev3.0.2-b6
Release Piwik 3.0.2-b6
17 files changed, 349 insertions, 22 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 933ff75ab0..85edaadcc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ The Product Changelog at **[piwik.org/changelog](http://piwik.org/changelog)** l * Added JavaScript Tracker method `deleteCustomVariables` to delete all custom variables within a certain scope * The method `enableLinkTracking` can now be called several times to make Piwik aware of newly added links when your DOM changes * Added a new method `Piwik\Plugin\Report::getMetricNamesToProcessReportTotals()` that lets you define which metrics should show percentages in the table report visualization on hover. If defined, these percentages will be automatically calculated. +* New HTTP API method `UserCountry.getCountryCodeMapping` to get a list of used country codes to country names ## Piwik 3.0.1 diff --git a/core/Plugin/Controller.php b/core/Plugin/Controller.php index c7b9e9c78e..4d186ab15f 100644 --- a/core/Plugin/Controller.php +++ b/core/Plugin/Controller.php @@ -708,7 +708,7 @@ abstract class Controller $general = PiwikConfig::getInstance()->General; $view->enableFrames = $general['enable_framed_pages'] || (isset($general['enable_framed_logins']) && $general['enable_framed_logins']); - $embeddedAsIframe = (Common::getRequestVar('module') == 'Widgetize'); + $embeddedAsIframe = (Common::getRequestVar('module', '', 'string') == 'Widgetize'); if (!$view->enableFrames && !$embeddedAsIframe) { $view->setXFrameOptions('sameorigin'); } diff --git a/core/ProfessionalServices/Advertising.php b/core/ProfessionalServices/Advertising.php index ef423200ae..1c938b5efd 100644 --- a/core/ProfessionalServices/Advertising.php +++ b/core/ProfessionalServices/Advertising.php @@ -55,7 +55,7 @@ class Advertising */ public function getPromoUrlForProfessionalServices($campaignMedium, $campaignContent = '') { - $url = 'https://piwik.org/consulting/?'; + $url = 'https://piwik.org/support/?'; $campaign = $this->getCampaignParametersForPromoUrl( $name = self::CAMPAIGN_NAME_PROFESSIONAL_SERVICES, diff --git a/core/Version.php b/core/Version.php index 84a188f1f5..5b5e0599f3 100644 --- a/core/Version.php +++ b/core/Version.php @@ -20,7 +20,7 @@ final class Version * The current Piwik version. * @var string */ - const VERSION = '3.0.2-b5'; + const VERSION = '3.0.2-b6'; public function isStableVersion($version) { diff --git a/plugins/Installation/FormSuperUser.php b/plugins/Installation/FormSuperUser.php index ff41d2f617..b6be3f4f92 100644 --- a/plugins/Installation/FormSuperUser.php +++ b/plugins/Installation/FormSuperUser.php @@ -59,7 +59,7 @@ class FormSuperUser extends QuickForm2 )); $professionalServicesNewsletter = Piwik::translate('Installation_ProfessionalServicesNewsletter', - array("<a href='http://piwik.org/consulting/?pk_medium=App_Newsletter_link&pk_source=Piwik_App&pk_campaign=App_Installation' style='color:#444;' rel='noreferrer' target='_blank'>", "</a>") + array("<a href='https://piwik.org/support/?pk_medium=App_Newsletter_link&pk_source=Piwik_App&pk_campaign=App_Installation' style='color:#444;' rel='noreferrer' target='_blank'>", "</a>") ); $currentLanguage = StaticContainer::get('Piwik\Translation\Translator')->getCurrentLanguage(); diff --git a/plugins/UserCountry/API.php b/plugins/UserCountry/API.php index f36e7e70b8..176030ec31 100644 --- a/plugins/UserCountry/API.php +++ b/plugins/UserCountry/API.php @@ -10,6 +10,7 @@ namespace Piwik\Plugins\UserCountry; use Exception; use Piwik\Archive; +use Piwik\Container\StaticContainer; use Piwik\DataTable; use Piwik\Metrics; use Piwik\Piwik; @@ -165,6 +166,24 @@ class API extends \Piwik\Plugin\API } /** + * Returns a simple mapping from country code to country name + * + * @return \string[] + */ + public function getCountryCodeMapping() + { + $regionDataProvider = StaticContainer::get('Piwik\Intl\Data\Provider\RegionDataProvider'); + + $countryCodeList = $regionDataProvider->getCountryList(); + + array_walk($countryCodeList, function(&$item, $key) { + $item = Piwik::translate('Intl_Country_'.strtoupper($key)); + }); + + return $countryCodeList; + } + + /** * Uses a location provider to find/guess the location of an IP address. * * See LocationProvider::getLocation to see the details diff --git a/plugins/UserCountry/tests/System/StaticAPITest.php b/plugins/UserCountry/tests/System/StaticAPITest.php new file mode 100644 index 0000000000..9959c56e6d --- /dev/null +++ b/plugins/UserCountry/tests/System/StaticAPITest.php @@ -0,0 +1,49 @@ +<?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\UserCountry\tests\System; + +use Piwik\Tests\Framework\TestCase\SystemTestCase; + +/** + * @group UserCountry + * @group ApiTest + * @group Plugins + */ +class StaticApiTest extends SystemTestCase +{ + /** + * @dataProvider getApiForTesting + */ + public function testApi($api, $params) + { + $this->runApiTests($api, $params); + } + + public function getApiForTesting() + { + $apiToTest = array(); + $apiToTest[] = array(array('UserCountry.getCountryCodeMapping'), + array( + 'language' => 'en', + ) + ); + + return $apiToTest; + } + + public static function getOutputPrefix() + { + return ''; + } + + public static function getPathToTestDirectory() + { + return dirname(__FILE__); + } +}
\ No newline at end of file diff --git a/plugins/UserCountry/tests/System/expected/test___UserCountry.getCountryCodeMapping.xml b/plugins/UserCountry/tests/System/expected/test___UserCountry.getCountryCodeMapping.xml new file mode 100644 index 0000000000..748c4b2023 --- /dev/null +++ b/plugins/UserCountry/tests/System/expected/test___UserCountry.getCountryCodeMapping.xml @@ -0,0 +1,255 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <ad>Andorra</ad> + <ae>United Arab Emirates</ae> + <af>Afghanistan</af> + <ag>Antigua & Barbuda</ag> + <ai>Anguilla</ai> + <al>Albania</al> + <am>Armenia</am> + <ao>Angola</ao> + <aq>Antarctica</aq> + <ar>Argentina</ar> + <as>American Samoa</as> + <at>Austria</at> + <au>Australia</au> + <aw>Aruba</aw> + <ax>Åland Islands</ax> + <az>Azerbaijan</az> + <ba>Bosnia & Herzegovina</ba> + <bb>Barbados</bb> + <bd>Bangladesh</bd> + <be>Belgium</be> + <bf>Burkina Faso</bf> + <bg>Bulgaria</bg> + <bh>Bahrain</bh> + <bi>Burundi</bi> + <bj>Benin</bj> + <bl>St. Barthélemy</bl> + <bm>Bermuda</bm> + <bn>Brunei</bn> + <bo>Bolivia</bo> + <bq>Caribbean Netherlands</bq> + <br>Brazil</br> + <bs>Bahamas</bs> + <bt>Bhutan</bt> + <bv>Bouvet Island</bv> + <bw>Botswana</bw> + <by>Belarus</by> + <bz>Belize</bz> + <ca>Canada</ca> + <cc>Cocos (Keeling) Islands</cc> + <cd>Congo - Kinshasa</cd> + <cf>Central African Republic</cf> + <cg>Congo - Brazzaville</cg> + <ch>Switzerland</ch> + <ci>Côte d’Ivoire</ci> + <ck>Cook Islands</ck> + <cl>Chile</cl> + <cm>Cameroon</cm> + <cn>China</cn> + <co>Colombia</co> + <cr>Costa Rica</cr> + <cu>Cuba</cu> + <cv>Cape Verde</cv> + <cw>Curaçao</cw> + <cx>Christmas Island</cx> + <cy>Cyprus</cy> + <cz>Czech Republic</cz> + <de>Germany</de> + <dj>Djibouti</dj> + <dk>Denmark</dk> + <dm>Dominica</dm> + <do>Dominican Republic</do> + <dz>Algeria</dz> + <ec>Ecuador</ec> + <ee>Estonia</ee> + <eg>Egypt</eg> + <eh>Western Sahara</eh> + <er>Eritrea</er> + <es>Spain</es> + <et>Ethiopia</et> + <fi>Finland</fi> + <fj>Fiji</fj> + <fk>Falkland Islands</fk> + <fm>Micronesia</fm> + <fo>Faroe Islands</fo> + <fr>France</fr> + <ga>Gabon</ga> + <gb>United Kingdom</gb> + <gd>Grenada</gd> + <ge>Georgia</ge> + <gf>French Guiana</gf> + <gg>Guernsey</gg> + <gh>Ghana</gh> + <gi>Gibraltar</gi> + <gl>Greenland</gl> + <gm>Gambia</gm> + <gn>Guinea</gn> + <gp>Guadeloupe</gp> + <gq>Equatorial Guinea</gq> + <gr>Greece</gr> + <gs>South Georgia & South Sandwich Islands</gs> + <gt>Guatemala</gt> + <gu>Guam</gu> + <gw>Guinea-Bissau</gw> + <gy>Guyana</gy> + <hk>Hong Kong SAR China</hk> + <hm>Heard & McDonald Islands</hm> + <hn>Honduras</hn> + <hr>Croatia</hr> + <ht>Haiti</ht> + <hu>Hungary</hu> + <id>Indonesia</id> + <ie>Ireland</ie> + <il>Israel</il> + <im>Isle of Man</im> + <in>India</in> + <io>British Indian Ocean Territory</io> + <iq>Iraq</iq> + <ir>Iran</ir> + <is>Iceland</is> + <it>Italy</it> + <je>Jersey</je> + <jm>Jamaica</jm> + <jo>Jordan</jo> + <jp>Japan</jp> + <ke>Kenya</ke> + <kg>Kyrgyzstan</kg> + <kh>Cambodia</kh> + <ki>Kiribati</ki> + <km>Comoros</km> + <kn>St. Kitts & Nevis</kn> + <kp>North Korea</kp> + <kr>South Korea</kr> + <kw>Kuwait</kw> + <ky>Cayman Islands</ky> + <kz>Kazakhstan</kz> + <la>Laos</la> + <lb>Lebanon</lb> + <lc>St. Lucia</lc> + <li>Liechtenstein</li> + <lk>Sri Lanka</lk> + <lr>Liberia</lr> + <ls>Lesotho</ls> + <lt>Lithuania</lt> + <lu>Luxembourg</lu> + <lv>Latvia</lv> + <ly>Libya</ly> + <ma>Morocco</ma> + <mc>Monaco</mc> + <md>Moldova</md> + <me>Montenegro</me> + <mf>St. Martin</mf> + <mg>Madagascar</mg> + <mh>Marshall Islands</mh> + <mk>Macedonia</mk> + <ml>Mali</ml> + <mm>Myanmar (Burma)</mm> + <mn>Mongolia</mn> + <mo>Macau SAR China</mo> + <mp>Northern Mariana Islands</mp> + <mq>Martinique</mq> + <mr>Mauritania</mr> + <ms>Montserrat</ms> + <mt>Malta</mt> + <mu>Mauritius</mu> + <mv>Maldives</mv> + <mw>Malawi</mw> + <mx>Mexico</mx> + <my>Malaysia</my> + <mz>Mozambique</mz> + <na>Namibia</na> + <nc>New Caledonia</nc> + <ne>Niger</ne> + <nf>Norfolk Island</nf> + <ng>Nigeria</ng> + <ni>Nicaragua</ni> + <nl>Netherlands</nl> + <no>Norway</no> + <np>Nepal</np> + <nr>Nauru</nr> + <nu>Niue</nu> + <nz>New Zealand</nz> + <om>Oman</om> + <pa>Panama</pa> + <pe>Peru</pe> + <pf>French Polynesia</pf> + <pg>Papua New Guinea</pg> + <ph>Philippines</ph> + <pk>Pakistan</pk> + <pl>Poland</pl> + <pm>St. Pierre & Miquelon</pm> + <pn>Pitcairn Islands</pn> + <pr>Puerto Rico</pr> + <ps>Palestinian Territories</ps> + <pt>Portugal</pt> + <pw>Palau</pw> + <py>Paraguay</py> + <qa>Qatar</qa> + <re>Réunion</re> + <ro>Romania</ro> + <rs>Serbia</rs> + <ru>Russia</ru> + <rw>Rwanda</rw> + <sa>Saudi Arabia</sa> + <sb>Solomon Islands</sb> + <sc>Seychelles</sc> + <sd>Sudan</sd> + <se>Sweden</se> + <sg>Singapore</sg> + <sh>St. Helena</sh> + <si>Slovenia</si> + <sj>Svalbard & Jan Mayen</sj> + <sk>Slovakia</sk> + <sl>Sierra Leone</sl> + <sm>San Marino</sm> + <sn>Senegal</sn> + <so>Somalia</so> + <sr>Suriname</sr> + <ss>South Sudan</ss> + <st>São Tomé & Príncipe</st> + <sv>El Salvador</sv> + <sx>Sint Maarten</sx> + <sy>Syria</sy> + <sz>Swaziland</sz> + <tc>Turks & Caicos Islands</tc> + <td>Chad</td> + <tf>French Southern Territories</tf> + <tg>Togo</tg> + <th>Thailand</th> + <ti>Tibet</ti> + <tj>Tajikistan</tj> + <tk>Tokelau</tk> + <tl>Timor-Leste</tl> + <tm>Turkmenistan</tm> + <tn>Tunisia</tn> + <to>Tonga</to> + <tr>Turkey</tr> + <tt>Trinidad & Tobago</tt> + <tv>Tuvalu</tv> + <tw>Taiwan</tw> + <tz>Tanzania</tz> + <ua>Ukraine</ua> + <ug>Uganda</ug> + <um>U.S. Outlying Islands</um> + <us>United States</us> + <uy>Uruguay</uy> + <uz>Uzbekistan</uz> + <va>Vatican City</va> + <vc>St. Vincent & Grenadines</vc> + <ve>Venezuela</ve> + <vg>British Virgin Islands</vg> + <vi>U.S. Virgin Islands</vi> + <vn>Vietnam</vn> + <vu>Vanuatu</vu> + <wf>Wallis & Futuna</wf> + <ws>Samoa</ws> + <ye>Yemen</ye> + <yt>Mayotte</yt> + <za>South Africa</za> + <zm>Zambia</zm> + <zw>Zimbabwe</zw> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/Framework/TestRequest/Collection.php b/tests/PHPUnit/Framework/TestRequest/Collection.php index a2038fd873..287b4563a7 100644 --- a/tests/PHPUnit/Framework/TestRequest/Collection.php +++ b/tests/PHPUnit/Framework/TestRequest/Collection.php @@ -42,6 +42,7 @@ class Collection 'Annotations', 'SegmentEditor', 'UserCountry.getLocationFromIP', + 'UserCountry.getCountryCodeMapping', 'Dashboard', 'ExamplePluginTemplate', 'CustomAlerts', @@ -332,9 +333,11 @@ class Collection $this->apiToCall = $apiToCall; - if (!in_array('UserCountry.getLocationFromIP', $apiToCall)) { + if (!in_array('UserCountry.getLocationFromIP', $apiToCall) && + !in_array('UserCountry.getCountryCodeMapping', $apiToCall)) { $this->apiNotToCall = array('API.getPiwikVersion', - 'UserCountry.getLocationFromIP'); + 'UserCountry.getLocationFromIP', + 'UserCountry.getCountryCodeMapping'); } else { $this->apiNotToCall = array(); } diff --git a/tests/UI/expected-screenshots/DashboardManager_removed.png b/tests/UI/expected-screenshots/DashboardManager_removed.png index 2b980169e6..38244c3084 100644 --- a/tests/UI/expected-screenshots/DashboardManager_removed.png +++ b/tests/UI/expected-screenshots/DashboardManager_removed.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:613f57b24112efa26462817b198362f007ce57ad323178295c4093971da78359 -size 366770 +oid sha256:2b3588b01737a0ee874f115bbd605d0dce0e39e1000516e8ca221b59a3cb4961 +size 366902 diff --git a/tests/UI/expected-screenshots/Dashboard_loaded_token_auth.png b/tests/UI/expected-screenshots/Dashboard_loaded_token_auth.png index c8ef73bf04..28beac8fa7 100644 --- a/tests/UI/expected-screenshots/Dashboard_loaded_token_auth.png +++ b/tests/UI/expected-screenshots/Dashboard_loaded_token_auth.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:12df3f544d1bacb0ee0a34b4cc8e8eabbfe3da8c6cae8b3e59dd2ee49d3e464b -size 537961 +oid sha256:d4723f3747a76f988d21101636e7fc829ee86bea35ff73b3b1ef2a2a524e59cb +size 538083 diff --git a/tests/UI/expected-screenshots/Dashboard_removed.png b/tests/UI/expected-screenshots/Dashboard_removed.png index 961419dfee..7a62f15c31 100644 --- a/tests/UI/expected-screenshots/Dashboard_removed.png +++ b/tests/UI/expected-screenshots/Dashboard_removed.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1a841e2177f533da08b2382fabc3f91e6c54af227604f3d69a67ed79426785dc -size 537637 +oid sha256:805b856a9f0d1d51c163695ca4d301c2d3a17608e2c527f5f38341704c51b993 +size 537722 diff --git a/tests/UI/expected-screenshots/Theme_home.png b/tests/UI/expected-screenshots/Theme_home.png index 17793e92d2..3972a8774d 100644 --- a/tests/UI/expected-screenshots/Theme_home.png +++ b/tests/UI/expected-screenshots/Theme_home.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:21869e1be4501adf9e9e8d63a7c550d29f1860daa5e1149c312c84f5f078db83 -size 536690 +oid sha256:57b2802cb0e826a7425effb932ecd976a717d22fcaf29760fa4e5cd9b57171b6 +size 536754 diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_admin_plugins.png b/tests/UI/expected-screenshots/UIIntegrationTest_admin_plugins.png index c66bface3c..83ce827159 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_admin_plugins.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_admin_plugins.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9d574efe280f8b0c7860236b909c73d79f4d965736c634135aee7f5adc73efc5 -size 946958 +oid sha256:1dfe72aff4ea603f1c3ddfd0cdcfcd3e03d1230713e077054512e3fe2b682ac9 +size 955453 diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_api_listing.png b/tests/UI/expected-screenshots/UIIntegrationTest_api_listing.png index a53594da01..68ba833293 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_api_listing.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_api_listing.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3329e42371a9eaeffa71a082d03e99bf3128161ecb2cec73413957bb7f483cd5 -size 4188700 +oid sha256:0a52fa65a55dc98b5caffb25e2e984ad05079578d3e3b7b78f4d5dddfaf3c46d +size 4195468 diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_dashboard1.png b/tests/UI/expected-screenshots/UIIntegrationTest_dashboard1.png index 018d3b2cbd..48849c9345 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_dashboard1.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_dashboard1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8e9b3edd05bed09a4f0411f052cae8759fdf44a83db8f98bc19313f6f70c22fa -size 487730 +oid sha256:d7ea7d95e5960174a6ff5cb36069fc4d3708a3bab4c7be0904318cde545cf828 +size 487862 diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_menu_apidisallowed.png b/tests/UI/expected-screenshots/UIIntegrationTest_menu_apidisallowed.png index 21e8f2e424..bdfb7e2fb0 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_menu_apidisallowed.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_menu_apidisallowed.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a47b2faafccaae769f3814adf4a23a99d7fe04ec563b5a4ae736a963bae42980 -size 493755 +oid sha256:e709f1f350a1e4c7998e07542f3ebd78a37e6317b1ea94aff172fed90b08c8ce +size 493897 |