This repository has been archived by the owner on Aug 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
526589d
commit f83668b
Showing
61 changed files
with
1,944 additions
and
1,637 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
/** | ||
* Saves global plugin settings. | ||
* | ||
* This action can be overriden for a specific plugin by creating the | ||
* <plugin_id>/settings/save action in that plugin. | ||
* | ||
* @uses array $_REQUEST['params'] A set of key/value pairs to save to the ElggPlugin entity | ||
* @uses int $_REQUEST['plugin_id'] The ID of the plugin | ||
*/ | ||
|
||
$params = get_input('params'); | ||
$plugin_id = get_input('plugin_id'); | ||
$plugin = elgg_get_plugin_from_id($plugin_id); | ||
|
||
if (!$plugin) { | ||
return elgg_error_response(elgg_echo('plugins:settings:save:fail', [$plugin_id])); | ||
} | ||
|
||
$plugin_name = $plugin->getDisplayName(); | ||
|
||
$result = false; | ||
|
||
$config = [ | ||
'transport', | ||
'smtp_host_name', | ||
'smtp_host', | ||
'smtp_port', | ||
'smtp_connection', | ||
'smtp_username', | ||
'smtp_password', | ||
'smtp_ssl', | ||
'sparkpost_apikey', | ||
'sendgrid_apikey', | ||
'mailgun_apikey', | ||
'mailgun_domain', | ||
]; | ||
|
||
foreach ($params as $k => $v) { | ||
if (in_array($k, $config)) { | ||
elgg_save_config("email.$k", $v); | ||
} else { | ||
$result = $plugin->setSetting($k, $v); | ||
if (!$result) { | ||
return elgg_error_response(elgg_echo('plugins:settings:save:fail', [$plugin_name])); | ||
} | ||
} | ||
} | ||
|
||
return elgg_ok_response('', elgg_echo('plugins:settings:save:ok', [$plugin_name])); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace hypeJunction\Notifications; | ||
|
||
use Elgg\Hook; | ||
use Zend\Mail\Message; | ||
use Zend\Mime\Mime; | ||
use Zend\Mime\Part; | ||
|
||
class AddHtmlEmailPart { | ||
|
||
/** | ||
* Add HTML email part | ||
* | ||
* @param Hook $hook Hook | ||
* @return Message | ||
*/ | ||
public function __invoke(Hook $hook) { | ||
|
||
$message = $hook->getValue(); | ||
/* @var $message Message */ | ||
|
||
if (elgg_get_plugin_setting('enable_html_emails', 'hypeNotifications')) { | ||
|
||
$html_body = elgg_view('notifications/wrapper/html', [ | ||
'email' => $hook->getParam('email'), | ||
]); | ||
|
||
if ($html_body) { | ||
$html_part = new Part($html_body); | ||
$html_part->setCharset('UTF-8'); | ||
$html_part->setType(Mime::TYPE_HTML); | ||
|
||
$message->getBody()->addPart($html_part); | ||
} | ||
} | ||
|
||
return $message; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.