-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
3 changed files
with
185 additions
and
155 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
<?php | ||
|
||
use Drupal\Component\Utility\Html; | ||
|
||
/** | ||
* @file | ||
* This module allows you to protect any page of your website by secure | ||
* password. You can enter urls of pages to protect and set password per page. | ||
* Admin (uid = 1) or user with bypass protection permission can view page. | ||
*/ | ||
|
||
use Drupal\Component\Utility\Html; | ||
|
||
/** | ||
* Implements hook_mail(). | ||
* | ||
*/ | ||
function protected_pages_mail($key, &$message, $params) { | ||
|
||
switch ($key) { | ||
// Send a simple message from the contact form. | ||
case 'protected_pages_details_mail': | ||
switch ($key) { | ||
// Send a simple message from the contact form. | ||
case 'protected_pages_details_mail': | ||
|
||
$tokens = array('[protected-page-url]', '[site-name]'); | ||
$replcements = array( | ||
$params['protected_page_url'], \Drupal::config('system.site')->get('name'), | ||
); | ||
$tokens = array('[protected-page-url]', '[site-name]'); | ||
$replcements = array( | ||
$params['protected_page_url'], | ||
\Drupal::config('system.site')->get('name'), | ||
); | ||
|
||
$body = str_replace($tokens, $replcements, $params['body']); | ||
$body = str_replace($tokens, $replcements, $params['body']); | ||
|
||
$subject = $params['subject']; | ||
$message['subject'] = Html::escape($subject); | ||
$message['body'][] = Html::escape($body); | ||
$subject = $params['subject']; | ||
$message['subject'] = Html::escape($subject); | ||
$message['body'][] = Html::escape($body); | ||
|
||
break; | ||
} | ||
break; | ||
} | ||
} | ||
|
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