You are here

function _anonymous_publishing_cl_substitute_text in Anonymous Publishing 7

Helper function: Return with a variable value substituted.

If admin settings are set, return the overridden settings, else return defaults.

Parameters

string $id: The message ID.

array $variables: An array of substitutions.

Return value

text The text with the substitution applied. return strtr(variable_get('anonymous_publishing_cl_bylineguide', 'Use at least !reqchar characters for the byline.'), $variables);

4 calls to _anonymous_publishing_cl_substitute_text()
anonymous_publishing_cl_admin_email in modules/cl/anonymous_publishing_cl.admin.inc
Menu callback: Form to change content of email message.
anonymous_publishing_cl_admin_settings in modules/cl/anonymous_publishing_cl.admin.inc
Menu callback: Provide module settings page.
_anonymous_publishing_cl_alter_comment_or_node_form in modules/cl/anonymous_publishing_cl.module
Helper function to make form alterations to input form.
_anonymous_publishing_cl_send_email in modules/cl/anonymous_publishing_cl.admin.inc
Send verification email.

File

modules/cl/anonymous_publishing_cl.admin.inc, line 1220
Menu callbacks for the CL tabs on the module admin page.

Code

function _anonymous_publishing_cl_substitute_text($id, array $variables = array()) {

  // Check if an admin setting overrides the default string.
  $admin_setting = variable_get($id, FALSE);
  if ($admin_setting) {

    // Override. No need to santize here as it is santized when output.
    return strtr($admin_setting, $variables);
  }
  else {

    // No override, return the default string.
    switch ($id) {
      case 'anonymous_publishing_cl_bylineguide':
        return t('Use at least !reqchar characters for the byline.', $variables);
      case 'anonymous_publishing_cl_emailsubjectact':
        return t('Please activate your content on !site', $variables);
      case 'anonymous_publishing_cl_emailsubjectver':
        return t('Please verify the e-mail address for your content submission to !site', $variables);
      case 'anonymous_publishing_cl_emailaction':
        return t('Somebody has created content with title "!title" on !site.  You receive this e-mail because your e-mail address (!email) was given as the verification e-mail address. To !action, click or copy this link into the browser: !verification_uri. If this was not you, please ignore this message.', $variables);
      case 'anonymous_publishing_cl_emailactivate':
        return t('If you do not !action within !autodelhours hours, the content will be automatically deleted.', $variables);
      case 'anonymous_publishing_cl_emailverify':
        return t("After you've verified your e-mail address, your content will be placed in the moderation queue. It will be published when it has been approved by an administrator.");
      case 'anonymous_publishing_cl_emailnsubject':
        return t('Notification about anonymously published content on !site', $variables);
      case 'anonymous_publishing_cl_emailnbody':
        return t('Anonymous content with title "!title" has been published on !site.  The verification e-mail address was "!email".', $variables);
      default:
        return t('Error: Message ID "!id" does not exist.', array(
          '!id' => $id,
        ));
    }
  }
}