You are here

function simplenews_assert_uri in Simplenews 3.x

Same name and namespace in other branches
  1. 8.2 simplenews.module \simplenews_assert_uri()
  2. 8 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.

3 calls to simplenews_assert_uri()
drush_simplenews_spool_send in ./simplenews.drush.inc
Drush command to send the mail spool queue.
SimplenewsCommands::spoolSend in src/Commands/SimplenewsCommands.php
Send the defined amount of mail spool entries.
simplenews_cron in ./simplenews.module
Implements hook_cron().

File

./simplenews.module, line 316
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;
}