Skip to content

Commit

Permalink
Professional Services for Piwik, neutral branding within Piwik app (#…
Browse files Browse the repository at this point in the history
…10339)

Professional Services for Piwik - neutral branding within Piwik app
  • Loading branch information
mattab authored Jul 24, 2016
1 parent e5b8e09 commit 755dcf0
Show file tree
Hide file tree
Showing 56 changed files with 329 additions and 440 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ notifications:
slack:
rooms:
- piwik:3HWhNh21qPfDACQXTrJOb0mW
- piwikpro:7OABSbDrywSTo2nv9lD2svXG
on_success: :change
on_failure: :change

Expand Down
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,35 +58,38 @@ If you do not have a server, consider our Piwik Hosting partner: http://piwik.or

For the list of all tickets closed in the current and past releases, see http://piwik.org/changelog/. For the list of technical changes in the Piwik platform, see [http://developer.piwik.org/changelog](http://developer.piwik.org/changelog).

## Participate!
## Get involved!

We believe in liberating Web Analytics, providing a free platform for simple and advanced analytics. Piwik was built by dozens of people like you,
and we need your help to make Piwik better… Why not participate in a useful project today?

You will find pointers on how you can participate in Piwik at http://piwik.org/get-involved/
and we need your help to make Piwik better… Why not participate in a useful project today? [Learn how you can contribute to Piwik.](https://piwik.org/get-involved)

## Quality Assurance

The Piwik project uses an ever-expanding comprehensive set of thousands of unit tests and hundreds of automated integration tests, system tests, JavaScript tests, and screenshot UI tests, running on a continuous integration server as part of its software quality assurance.
The Piwik project uses an ever-expanding comprehensive set of thousands of unit tests and hundreds of automated integration tests, system tests, JavaScript tests, and screenshot UI tests, running on a continuous integration server as part of its software quality assurance. [Learn more](https://piwik.org/qa/)

We use [BrowserStack.com](https://www.browserstack.com/) testing tool to help check the Piwik user interface is compatible with many browsers.

[Learn more](https://piwik.org/qa/)

## Security

Security is a top priority at Piwik. As potential issues are discovered, we validate, patch and release fixes as quickly as we can. We have a security bug bounty program in place that rewards researchers for finding security issues and disclosing them to us.

[Learn more](https://piwik.org/security/)

## Support for Piwik

For **Free support**, post a message in our community forums: [forum.piwik.org](http://forum.piwik.org/)

For **Professional paid support**, send a message to our network of Piwik professionals: [piwik.org/support](http://piwik.org/contact/)

## Contact

http://piwik.org
Website: [piwik.org](https://piwik.org)

About us: [piwik.org/team/](https://piwik.org/team/)

Contact us: http://piwik.org/contact/ or hello@piwik.org
Contact us: [piwik.org/contact/](https://piwik.org/contact/)

About us: http://piwik.org/team/

## More information

Expand Down
7 changes: 3 additions & 4 deletions config/global.ini.php
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,8 @@
; on a per-request basis;
pivot_by_filter_default_column_limit = 10

; If set to 0 it will disable Piwik Pro advertisements in some places. For example in the installation screen, the
; Piwik Pro Ad widget will be removed etc.
piwik_pro_ads_enabled = 1
; If set to 0 it will disable advertisements for providers of Professional Support for Piwik.
piwik_professional_support_ads_enabled = 1

[Tracker]

Expand Down Expand Up @@ -804,7 +803,7 @@
Plugins[] = DevicePlugins
Plugins[] = Heartbeat
Plugins[] = Intl
Plugins[] = PiwikPro
Plugins[] = ProfessionalServices
Plugins[] = UserId

[PluginsInstalled]
Expand Down
3 changes: 2 additions & 1 deletion core/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Exception;
use Piwik\Application\Kernel\GlobalSettingsProvider;
use Piwik\Container\StaticContainer;
use Piwik\ProfessionalServices\Advertising;

/**
* Singleton that provides read & write access to Piwik's INI configuration.
Expand Down Expand Up @@ -158,7 +159,7 @@ public function getClientSideOptions()
'autocomplete_min_sites' => $general['autocomplete_min_sites'],
'datatable_export_range_as_day' => $general['datatable_export_range_as_day'],
'datatable_row_limits' => $this->getDatatableRowLimits(),
'are_ads_enabled' => $general['piwik_pro_ads_enabled']
'are_ads_enabled' => Advertising::isAdsEnabledInConfig($general)
);
}

Expand Down
6 changes: 0 additions & 6 deletions core/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,6 @@ private function getDefaultPiwikCommands()
$commands = array(
'Piwik\CliMulti\RequestCommand'
);

if (class_exists('Piwik\Plugins\EnterpriseAdmin\EnterpriseAdmin')) {
$extra = new \Piwik\Plugins\EnterpriseAdmin\EnterpriseAdmin();
$extra->addConsoleCommands($commands);
}

return $commands;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\PiwikPro;
namespace Piwik\ProfessionalServices;

use Piwik\Plugin;
use Piwik\Config;

/**
* Piwik PRO Advertising related methods. Lets you for example check whether advertising is enabled, generate
* links for different landing pages etc.
* Advertising for providers of Professional Support for Piwik.
*
* Lets you for example check whether advertising is enabled, generate links for different landing pages etc.
*
* @api
* @since 2.16.0
*/
class Advertising
{
const CAMPAIGN_NAME_UPGRADE_TO_PRO = 'Upgrade_to_Pro';
const CAMPAIGN_NAME_UPGRADE_TO_CLOUD = 'Upgrade_to_Cloud';
const CAMPAIGN_NAME_PROFESSIONAL_SERVICES = 'App_ProfessionalServices';

/**
* @var Plugin\Manager
Expand All @@ -39,36 +38,27 @@ public function __construct(Plugin\Manager $pluginManager, Config $config)
}

/**
* Returns true if it is ok to show some Piwik PRO advertising in the Piwik UI.
* Returns true if it is ok to show some advertising in the Piwik UI.
* @return bool
*/
public function arePiwikProAdsEnabled()
public function areAdsForProfessionalServicesEnabled()
{
if ($this->pluginManager->isPluginActivated('EnterpriseAdmin')
|| $this->pluginManager->isPluginActivated('LoginAdmin')
|| $this->pluginManager->isPluginActivated('CloudAdmin')
|| $this->pluginManager->isPluginActivated('WhiteLabel')) {
return false;
}

$showAds = $this->config->General['piwik_pro_ads_enabled'];

return !empty($showAds);
return $this->isAdsEnabledInConfig($this->config->General);
}

/**
* Get URL for promoting the Piwik Cloud.
* Get URL for promoting Professional Services for Piwik
*
* @param string $campaignMedium
* @param string $campaignContent
* @return string
*/
public function getPromoUrlForCloud($campaignMedium, $campaignContent = '')
public function getPromoUrlForProfessionalServices($campaignMedium, $campaignContent = '')
{
$url = 'https://piwik.pro/cloud/?';
$url = 'https://piwik.org/consulting/?';

$campaign = $this->getCampaignParametersForPromoUrl(
$name = self::CAMPAIGN_NAME_UPGRADE_TO_CLOUD,
$name = self::CAMPAIGN_NAME_PROFESSIONAL_SERVICES,
$campaignMedium,
$campaignContent
);
Expand All @@ -77,26 +67,18 @@ public function getPromoUrlForCloud($campaignMedium, $campaignContent = '')
}

/**
* Get URL for promoting Piwik On Premises.
* @param string $campaignMedium
* @param string $campaignContent
* Get URL for letting people know about upgrade to On premises
*
* @return string
*/
public function getPromoUrlForOnPremises($campaignMedium, $campaignContent = '')
public function getPromoUrlForPiwikProUpgrade()
{
$url = 'https://piwik.pro/c/upgrade/?';

$campaign = $this->getCampaignParametersForPromoUrl(
$name = self::CAMPAIGN_NAME_UPGRADE_TO_PRO,
$campaignMedium,
$campaignContent
);

return $url . $campaign;
return 'https://piwik.org/recommends/piwik-pro-from-app';
}

/**
* Appends campaign parameters to the given URL for promoting any Piwik PRO service.
* Appends campaign parameters to the given URL for promoting any Professional Support for Piwik service.
*
* @param string $url
* @param string $campaignName
* @param string $campaignMedium
Expand All @@ -121,7 +103,7 @@ public function addPromoCampaignParametersToUrl($url, $campaignName, $campaignMe
}

/**
* Generates campaign URL parameters that can be used with any promotion link for Piwik PRO.
* Generates campaign URL parameters that can be used with promoting Professional Support service.
*
* @param string $campaignName
* @param string $campaignMedium
Expand All @@ -138,4 +120,15 @@ private function getCampaignParametersForPromoUrl($campaignName, $campaignMedium

return $campaignName;
}

/**
* @param $configGeneralSection
* @return bool
*/
public static function isAdsEnabledInConfig($configGeneralSection)
{
$oldSettingValue = @$configGeneralSection['piwik_pro_ads_enabled'];
$newSettingValue = @$configGeneralSection['piwik_professional_support_ads_enabled'];
return (bool) ($newSettingValue || $oldSettingValue);
}
}
45 changes: 2 additions & 43 deletions core/Twig.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@ public function __construct()
$this->addFilter_percent();
$this->addFilter_percentage();
$this->addFilter_percentEvolution();
$this->addFilter_piwikProAdLink();
$this->addFilter_piwikProOnPremisesAdLink();
$this->addFilter_piwikProCloudAdLink();
$this->addFilter_prettyDate();
$this->addFilter_safeDecodeRaw();
$this->addFilter_number();
Expand Down Expand Up @@ -418,47 +415,9 @@ protected function addFilter_percentEvolution()
$this->twig->addFilter($percentage);
}

protected function addFilter_piwikProAdLink()
private function getProfessionalServicesAdvertising()
{
$ads = $this->getPiwikProAdvertising();
$piwikProAd = new Twig_SimpleFilter('piwikProCampaignParameters', function ($url, $campaignName, $campaignMedium, $campaignContent = '') use ($ads) {
$url = $ads->addPromoCampaignParametersToUrl($url, $campaignName, $campaignMedium, $campaignContent);
return $url;
});
$this->twig->addFilter($piwikProAd);
}

protected function addFilter_piwikProOnPremisesAdLink()
{
$twigEnv = $this->getTwigEnvironment();
$ads = $this->getPiwikProAdvertising();
$piwikProAd = new Twig_SimpleFilter('piwikProOnPremisesPromoUrl', function ($medium, $content = '') use ($twigEnv, $ads) {

$url = $ads->getPromoUrlForOnPremises($medium, $content);

return twig_escape_filter($twigEnv, $url, 'html_attr');

}, array('is_safe' => array('html_attr')));
$this->twig->addFilter($piwikProAd);
}

protected function addFilter_piwikProCloudAdLink()
{
$twigEnv = $this->getTwigEnvironment();
$ads = $this->getPiwikProAdvertising();
$piwikProAd = new Twig_SimpleFilter('piwikProCloudPromoUrl', function ($medium, $content = '') use ($twigEnv, $ads) {

$url = $ads->getPromoUrlForCloud($medium, $content);

return twig_escape_filter($twigEnv, $url, 'html_attr');

}, array('is_safe' => array('html_attr')));
$this->twig->addFilter($piwikProAd);
}

private function getPiwikProAdvertising()
{
return StaticContainer::get('Piwik\PiwikPro\Advertising');
return StaticContainer::get('Piwik\ProfessionalServices\Advertising');
}

protected function addFilter_number()
Expand Down
28 changes: 0 additions & 28 deletions core/Updates/2.16.0-rc2.php

This file was deleted.

34 changes: 34 additions & 0 deletions core/Updates/2.16.2-b5.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?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\Updates;

use Piwik\Updater;
use Piwik\Updates as PiwikUpdates;

/**
* Update for version 2.16.2-b5
*/
class Updates_2_16_2_b5 extends PiwikUpdates
{

public function doUpdate(Updater $updater)
{
try {
\Piwik\Plugin\Manager::getInstance()->activatePlugin('ProfessionalServices');
} catch (\Exception $e) {
}

try {
\Piwik\Plugin\Manager::getInstance()->deactivatePlugin('ProfessionalServices');
self::deletePluginFromConfigFile('ProfessionalServices');
} catch (\Exception $e) {
}
}
}
6 changes: 3 additions & 3 deletions core/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
* which is outputted in the template, eg, `{{ postEvent('MyPlugin.event') }}`
* - **isPluginLoaded**: Returns true if the supplied plugin is loaded, false if otherwise.
* `{% if isPluginLoaded('Goals') %}...{% endif %}`
* - **arePiwikProAdsEnabled**: Returns true if it is ok to show some Piwik PRO advertising in the UI (from Piwik 2.16.0)
* - **areAdsForProfessionalServicesEnabled**: Returns true if it is ok to show some advertising in the UI for providers of Professional Support for Piwik (from Piwik 2.16.0)
*
* ### Examples
*
Expand Down Expand Up @@ -229,8 +229,8 @@ public function render()
$this->disableLink = Common::getRequestVar('disableLink', 0, 'int');
$this->isWidget = Common::getRequestVar('widget', 0, 'int');

$piwikProAds = StaticContainer::get('Piwik\PiwikPro\Advertising');
$this->arePiwikProAdsEnabled = $piwikProAds->arePiwikProAdsEnabled();
$piwikAds = StaticContainer::get('Piwik\ProfessionalServices\Advertising');
$this->areAdsForProfessionalServicesEnabled = $piwikAds->areAdsForProfessionalServicesEnabled();

if (Development::isEnabled()) {
$cacheBuster = rand(0, 10000);
Expand Down
2 changes: 1 addition & 1 deletion core/testMinimumPhpVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function Piwik_GetErrorMessagePage($message, $optionalTrace = false, $optionalLi
<li><a rel="noreferrer" target="_blank" href="http://piwik.org/faq/">Piwik Frequently Asked Questions</a></li>
<li><a rel="noreferrer" target="_blank" href="http://piwik.org/docs/">Piwik Documentation</a></li>
<li><a rel="noreferrer" target="_blank" href="http://forum.piwik.org/">Piwik Forums</a></li>
<li><a rel="noreferrer" target="_blank" href="https://piwik.pro/contact/?pk_campaign=App_AnErrorOccured&pk_source=Piwik_App&pk_medium=ProfessionalServicesLink#contact-form">Professional help (Piwik PRO)</a></li>
<li><a rel="noreferrer" target="_blank" href="https://piwik.org/support/?pk_campaign=App_AnErrorOccured&pk_source=Piwik_App&pk_medium=ProfessionalServicesLink">Professional help for Piwik</a></li>
</ul>';
}
if ($optionalLinkBack) {
Expand Down
2 changes: 1 addition & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
"Password": "Password",
"Period": "Period",
"Piechart": "Piechart",
"PiwikIsACollaborativeProjectYouCanContributeAndDonate": "%1$sPiwik%2$s is a collaborative project brought to you by the %7$sPiwik team%8$s members as well as many other contributors around the globe. If you're a fan of Piwik, you can help: find out %3$sHow to participate in Piwik%4$s, or %5$sdonate now%6$s to help fund Piwik 3.0!",
"PiwikIsACollaborativeProjectYouCanContributeAndDonate": "%1$sPiwik%2$s is a collaborative project brought to you by the %7$sPiwik team%8$s members as well as many other contributors around the globe. <br/> If you're a fan of Piwik, you can help: find out %3$sHow to participate in Piwik%4$s, or %5$sdonate now%6$s to help fund Piwik 3.0!",
"PiwikXIsAvailablePleaseNotifyPiwikAdmin": "%1$s is available. Please notify the %2$sPiwik administrator%3$s.",
"PiwikXIsAvailablePleaseUpdateNow": "Piwik %1$s is available. %2$sPlease update now!%3$s (see %4$schanges%5$s).",
"PleaseSpecifyValue": "Please specify a value for '%s'.",
Expand Down
Loading

0 comments on commit 755dcf0

Please sign in to comment.