diff options
author | Matthieu Aubry <mattab@users.noreply.github.com> | 2016-07-25 01:37:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-25 01:37:29 +0300 |
commit | 755dcf042d201810cbe07e90f74c84a3777f46d6 (patch) | |
tree | 02e5d500f25eb31193bad3d8e2bc3fea084f383b /plugins/ProfessionalServices | |
parent | e5b8e0973b76cf63fd9ad53d6b0095135dc439c8 (diff) |
Professional Services for Piwik, neutral branding within Piwik app (#10339)
Professional Services for Piwik - neutral branding within Piwik app
Diffstat (limited to 'plugins/ProfessionalServices')
-rw-r--r-- | plugins/ProfessionalServices/ProfessionalServices.php | 48 | ||||
-rw-r--r-- | plugins/ProfessionalServices/Promo.php | 65 | ||||
-rw-r--r-- | plugins/ProfessionalServices/Widgets.php | 60 | ||||
-rw-r--r-- | plugins/ProfessionalServices/config/test.php | 13 | ||||
-rw-r--r-- | plugins/ProfessionalServices/images/promo.png | bin | 0 -> 2349 bytes | |||
-rw-r--r-- | plugins/ProfessionalServices/lang/en.json | 5 | ||||
-rw-r--r-- | plugins/ProfessionalServices/plugin.json | 4 | ||||
-rw-r--r-- | plugins/ProfessionalServices/stylesheets/widget.less | 29 | ||||
-rw-r--r-- | plugins/ProfessionalServices/templates/promoServicesWidget.twig | 12 | ||||
-rw-r--r-- | plugins/ProfessionalServices/tests/Framework/Mock/Promo.php | 22 |
10 files changed, 258 insertions, 0 deletions
diff --git a/plugins/ProfessionalServices/ProfessionalServices.php b/plugins/ProfessionalServices/ProfessionalServices.php new file mode 100644 index 0000000000..203c3bb6f6 --- /dev/null +++ b/plugins/ProfessionalServices/ProfessionalServices.php @@ -0,0 +1,48 @@ +<?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\ProfessionalServices; + +class ProfessionalServices extends \Piwik\Plugin +{ + /** + * @see Piwik\Plugin::registerEvents + */ + public function registerEvents() + { + return array( + 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', + 'Request.getRenamedModuleAndAction' => 'renameProfessionalServicesModule', + ); + } + + public function getStylesheetFiles(&$stylesheets) + { + $stylesheets[] = 'plugins/ProfessionalServices/stylesheets/widget.less'; + } + + /** + * @deprecated Can be removed in Piwik 3.0 + * @param $module + * @param $action + */ + public function renameProfessionalServicesModule(&$module, &$action) + { + if ($module == 'ProfessionalServices') { + $module = 'ProfessionalServices'; + + if($action == 'promoPiwikPro') { + $action = 'promoServices'; + } + + if($action == 'rssPiwikPro') { + $action = 'rss'; + } + } + } +} diff --git a/plugins/ProfessionalServices/Promo.php b/plugins/ProfessionalServices/Promo.php new file mode 100644 index 0000000000..36f8ae155d --- /dev/null +++ b/plugins/ProfessionalServices/Promo.php @@ -0,0 +1,65 @@ +<?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\ProfessionalServices; + +class Promo +{ + protected $linkTitles = array('Read more', 'Learn more'); + + protected $content = array( + array( + 'campaignContent' => 'discoverPower', + 'text' => 'Discover the power of open-source combined with enterprise-grade support and premium functionalities.' + ), + array( + 'campaignContent' => 'bringEnterpriseLevel', + 'text' => 'Bring your analytics to enterprise level. Upgrade your Piwik platform and receive access to numerous premium features and assistance from experts.' + ), + array( + 'campaignContent' => 'funnelAnalytics', + 'text' => 'Want Funnel Analytics? Get Premium features and enterprise-grade support.' + ), + array( + 'campaignContent' => 'monitoringAndIncident', + 'text' => 'Do you need 24/7 Monitoring and Incident Handling for your Piwik? Get Premium features and enterprise-grade support.' + ), + array( + 'campaignContent' => 'slowingDown', + 'text' => 'Is your Piwik slowing down? Piwik experts can help with your server setup!' + ), + array( + 'campaignContent' => 'excitingFeatures', + 'text' => 'Want to know how to use all the exciting features in Piwik? Try a User training to be up to speed with working with Piwik.' + ), + array( + 'campaignContent' => 'slowingDown', + 'text' => 'Did you know you can adjust the look and feel of Piwik to your brand, and even replace "Piwik" with your product name? Try the White Label product!', + ), + array( + 'campaignContent' => 'metaSites', + 'text' => 'Did you know you can aggregate the tracked data across hundreds of sites and display it in a single dashboard? Get Premium features and enterprise-grade support.', + ), + ); + + public function getLinkTitle() + { + $titles = $this->linkTitles; + shuffle($titles); + + return array_shift($titles); + } + + public function getContent() + { + $content = $this->content; + shuffle($content); + + return array_shift($content); + } +} diff --git a/plugins/ProfessionalServices/Widgets.php b/plugins/ProfessionalServices/Widgets.php new file mode 100644 index 0000000000..b1abc5e7da --- /dev/null +++ b/plugins/ProfessionalServices/Widgets.php @@ -0,0 +1,60 @@ +<?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\ProfessionalServices; + +use Piwik\Piwik; +use Piwik\ProfessionalServices\Advertising; +use Piwik\Plugins\ExampleRssWidget\RssRenderer; +use Piwik\View; + +class Widgets extends \Piwik\Plugin\Widgets +{ + protected $category = 'About Piwik'; + + /** + * @var Advertising + */ + private $advertising; + + /** + * @var Promo + */ + private $promo; + + public function __construct(Advertising $advertising, Promo $promo) + { + $this->advertising = $advertising; + $this->promo = $promo; + } + + protected function init() + { + if ($this->advertising->areAdsForProfessionalServicesEnabled()) { + $this->addWidget('ProfessionalServices_WidgetProfessionalServicesForPiwik', 'promoServices'); + } + } + + public function rss() + { + return ''; + } + + public function promoServices() + { + $view = new View('@ProfessionalServices/promoServicesWidget'); + + $promo = $this->promo->getContent(); + + $view->ctaLinkUrl = $this->advertising->getPromoUrlForPiwikProUpgrade(); + $view->ctaText = $promo['text']; + $view->ctaLinkTitle = $this->promo->getLinkTitle(); + + return $view->render(); + } +} diff --git a/plugins/ProfessionalServices/config/test.php b/plugins/ProfessionalServices/config/test.php new file mode 100644 index 0000000000..03ad8662fd --- /dev/null +++ b/plugins/ProfessionalServices/config/test.php @@ -0,0 +1,13 @@ +<?php + +use Piwik\Tests\Framework\Mock\ProfessionalServices\Advertising; +use Piwik\Plugins\ProfessionalServices\tests\Framework\Mock\Promo; + +return array( + 'Piwik\ProfessionalServices\Advertising' => function () { + return new Advertising(); + }, + 'Piwik\Plugins\ProfessionalServices\Promo' => function () { + return new Promo(); + } +); diff --git a/plugins/ProfessionalServices/images/promo.png b/plugins/ProfessionalServices/images/promo.png Binary files differnew file mode 100644 index 0000000000..ac15b596df --- /dev/null +++ b/plugins/ProfessionalServices/images/promo.png diff --git a/plugins/ProfessionalServices/lang/en.json b/plugins/ProfessionalServices/lang/en.json new file mode 100644 index 0000000000..1f275d103f --- /dev/null +++ b/plugins/ProfessionalServices/lang/en.json @@ -0,0 +1,5 @@ +{ + "ProfessionalServices": { + "WidgetProfessionalServicesForPiwik": "Professional Services for Piwik" + } +}
\ No newline at end of file diff --git a/plugins/ProfessionalServices/plugin.json b/plugins/ProfessionalServices/plugin.json new file mode 100644 index 0000000000..852b094b37 --- /dev/null +++ b/plugins/ProfessionalServices/plugin.json @@ -0,0 +1,4 @@ +{ + "name": "ProfessionalServices", + "description": "Provides widgets to learn about Professional services and products for Piwik." +}
\ No newline at end of file diff --git a/plugins/ProfessionalServices/stylesheets/widget.less b/plugins/ProfessionalServices/stylesheets/widget.less new file mode 100644 index 0000000000..fdb9cb1eae --- /dev/null +++ b/plugins/ProfessionalServices/stylesheets/widget.less @@ -0,0 +1,29 @@ +.promoWidget { + // hard coded background color because image has hardcoded background + background-color: white; + + .promo { + padding: 20px; + &:after { + content: ''; + clear: both; + visibility: hidden; + } + } + .text { + overflow: hidden; + } + hr { + margin: 0px; + } + .link { + padding: 20px; + } + .icon { + margin-top:20px; + width: 64px; + height: 64px; + float: left; + margin-right: 20px; + } +}
\ No newline at end of file diff --git a/plugins/ProfessionalServices/templates/promoServicesWidget.twig b/plugins/ProfessionalServices/templates/promoServicesWidget.twig new file mode 100644 index 0000000000..67f87df40a --- /dev/null +++ b/plugins/ProfessionalServices/templates/promoServicesWidget.twig @@ -0,0 +1,12 @@ +<div class="promoWidget"> + <div class="promo"> + <img class="icon" src="plugins/ProfessionalServices/images/promo.png"> + <p class="text"> + {{ ctaText }} + <br /><br /> + <a class="btn" href="{{ ctaLinkUrl|e('html_attr') }}" target="_blank" rel="noreferrer"> + {{ ctaLinkTitle }} + </a> + </p> + </div> +</div>
\ No newline at end of file diff --git a/plugins/ProfessionalServices/tests/Framework/Mock/Promo.php b/plugins/ProfessionalServices/tests/Framework/Mock/Promo.php new file mode 100644 index 0000000000..a854b9da8a --- /dev/null +++ b/plugins/ProfessionalServices/tests/Framework/Mock/Promo.php @@ -0,0 +1,22 @@ +<?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\ProfessionalServices\tests\Framework\Mock; + +class Promo extends \Piwik\Plugins\ProfessionalServices\Promo +{ + public function getLinkTitle() + { + return $this->linkTitles[0]; + } + + public function getContent() + { + return $this->content[0]; + } +}
\ No newline at end of file |