diff options
author | Stefan Giehl <stefan@piwik.org> | 2017-02-19 13:28:59 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2017-02-19 13:28:59 +0300 |
commit | 471aaea1166bc71c8bd28c953e4b192f72646070 (patch) | |
tree | db3f3dcbb6e6e21e312b0babd11ac4c2dd16fb4d /plugins/MobileMessaging/SMSProvider/Development.php | |
parent | 918ef6f92c9a44be67fc8d11442f6eefd925e781 (diff) |
Implements new SMS Provider ASPSMS.com (#11263)
* makes it possible to define the required credential fields in sms provider
* show error message if configured sms provider doesn't work, instead of throwing uncatched exception
* Adds new SMS provider ASPSMS.com
* Development SMS notifications didn't work when clicking 'send now'
Caused by the session already closed before, as it's done using a ajax request
calling a Session:start() reopens the session. Might be a bit hackish, but should be fine for development
* adds UI test for switching sms provider
* Makes API-Key default credential field to prevent breaking third party plugins
* fixes issue where save button was disabled falsely
Diffstat (limited to 'plugins/MobileMessaging/SMSProvider/Development.php')
-rw-r--r-- | plugins/MobileMessaging/SMSProvider/Development.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/MobileMessaging/SMSProvider/Development.php b/plugins/MobileMessaging/SMSProvider/Development.php index 18cc57809a..b4a79e2dc1 100644 --- a/plugins/MobileMessaging/SMSProvider/Development.php +++ b/plugins/MobileMessaging/SMSProvider/Development.php @@ -11,6 +11,7 @@ namespace Piwik\Plugins\MobileMessaging\SMSProvider; use Piwik\Notification; use Piwik\Plugins\MobileMessaging\SMSProvider; use Piwik\Development as PiwikDevelopment; +use Piwik\Session; /** * Used for development only @@ -35,13 +36,19 @@ class Development extends SMSProvider return PiwikDevelopment::isEnabled(); } - public function verifyCredential($apiKey) + public function verifyCredential($credentials) { return true; } - public function sendSMS($apiKey, $smsText, $phoneNumber, $from) + public function getCredentialFields() { + return array(); + } + + public function sendSMS($credentials, $smsText, $phoneNumber, $from) + { + Session::start(); // ensure session is writable to add a notification $message = sprintf('An SMS was sent:<br />From: %s<br />To: %s<br />Message: %s', $from, $phoneNumber, $smsText); $notification = new Notification($message); @@ -50,7 +57,7 @@ class Development extends SMSProvider Notification\Manager::notify('StubbedSMSProvider'.preg_replace('/[^a-z0-9]/', '', $phoneNumber), $notification); } - public function getCreditLeft($apiKey) + public function getCreditLeft($credentials) { return 'Balance: 42'; } |