Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
synhelper
Commits
82495c96
Commit
82495c96
authored
Dec 25, 2017
by
APolitsin
Browse files
phpmail_alter
parent
484fa736
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Hook/PhpmailAlterFromAlter.php
0 → 100644
View file @
82495c96
<?php
namespace
Drupal\synhelper\Hook
;
use
Drupal\Core\Controller\ControllerBase
;
use
Drupal\synhelper\Controller\IdnaConvert
;
/**
* PreprocessHtml.
*/
class
PhpmailAlterFromAlter
extends
ControllerBase
{
/**
* Hook.
*/
public
static
function
hook
(
&
$mail
)
{
$idn
=
new
IdnaConvert
();
$mail
=
trim
(
$mail
);
$user
=
strstr
(
$mail
,
'@'
,
TRUE
);
$domain
=
strstr
(
$mail
,
'@'
);
$domain
=
substr
(
$domain
,
1
);
if
(
strpos
(
$domain
,
'>'
))
{
$domain
=
str_replace
(
'>'
,
''
,
$domain
);
$domain
=
$idn
->
encode
(
$domain
)
.
'>'
;
}
else
{
$domain
=
$idn
->
encode
(
$domain
);
}
$mail
=
"
{
$user
}
@
{
$domain
}
"
;
dsm
(
$mail
);
}
}
synhelper.module
View file @
82495c96
...
...
@@ -16,11 +16,19 @@ use Drupal\synhelper\Hook\FormNodePageFormAlter;
use
Drupal\synhelper\Hook\FormNodePageEditFormAlter
;
use
Drupal\synhelper\Hook\EntityPresave
;
use
Drupal\synhelper\Hook\CssAlter
;
use
Drupal\synhelper\Hook\PhpmailAlterFromAlter
;
use
Drupal\synhelper\Hook\FormUpdateManagerInstallFormAlter
;
use
Drupal\synhelper\Hook\FormFieldUiFieldStorageAddFormAlter
;
use
Drupal\synhelper\Hook\FormNodeTypeAddFormAlter
;
use
Drupal\synhelper\Hook\FormFieldConfigEditFormAlter
;
/**
* Implements hook_cmlexchange_orders_query_alter().
*/
function
synhelper_phpmail_alter_from_alter
(
&
$mail
)
{
PhpmailAlterFromAlter
::
hook
(
$mail
);
}
/**
* Implements hook_entity_presave().
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment