function simplenews_assert_uri in Simplenews 8
Same name and namespace in other branches
- 8.2 simplenews.module \simplenews_assert_uri()
- 3.x simplenews.module \simplenews_assert_uri()
Checks that the site URI is set, and sets an error message otherwise.
Return value
bool TRUE if the URI is set, otherwise FALSE.
2 calls to simplenews_assert_uri()
- drush_simplenews_spool_send in ./
simplenews.drush.inc - Drush command to send the mail spool queue.
- simplenews_cron in ./
simplenews.module - Implements hook_cron().
File
- ./
simplenews.module, line 311 - Simplenews node handling, sent email, newsletter block and general hooks
Code
function simplenews_assert_uri() {
$host = \Drupal::request()
->getHost();
// Check if the host name is configured.
if ($host == 'default') {
\Drupal::logger('simplenews')
->error('Stop sending newsletter to avoid broken links / SPAM. Site URI not specified.');
return FALSE;
}
return TRUE;
}