You are here

mail_debugger_common.module in Mail Debugger 7.3

File

modules/common/mail_debugger_common.module
View source
<?php

/**
 * Implement hook_mail_debugger_info();
 * @return type
 */
function mail_debugger_common_mail_debugger_info() {
  return array(
    'basic' => array(
      'include' => array(
        'inc',
        'mail_debugger_common',
        'includes/basic.mail_debugger',
      ),
      'title' => 'Basic',
      'form' => 'mail_debugger_basic_form',
      'validate' => 'mail_debugger_basic_form_validate',
      'submit' => 'mail_debugger_basic_form_submit',
      'weight' => -100,
    ),
    'user' => array(
      'include' => array(
        'inc',
        'mail_debugger_common',
        'includes/user.mail_debugger',
      ),
      'title' => 'User',
      'form' => 'mail_debugger_user_form',
      'validate' => 'mail_debugger_user_form_validate',
      'submit' => 'mail_debugger_user_form_submit',
      'weight' => -90,
    ),
  );
}

/**
 * Implement hook_menu();
 * @return array
 */
function mail_debugger_common_menu() {
  return array(
    'admin/config/development/mail_debugger/user_autocomplete_mail' => array(
      'page callback' => 'mail_debugger_user_callback_autocomplete_mail',
      'access arguments' => array(
        'use mail debugger user',
      ),
      'file' => 'includes/user.mail_debugger.inc',
      'type' => MENU_CALLBACK,
    ),
  );
}

/**
 * Implement hook_mail()
 * 
 * @param string $key
 * @param array $message
 * @param array $params
 */
function mail_debugger_common_mail($key, &$message, $params) {
  switch ($key) {
    case 'basic':
      $message['body'] = array(
        $params['body'],
      );
      $message['subject'] = $params['subject'];
      break;
    default:
      break;
  }
}

/**
 * Implement hook_permission();
 * Define permission for using the module
 * @return type
 */
function mail_debugger_common_permission() {
  return array(
    'use mail debugger basic' => array(
      'title' => t('Use mail debugger basic'),
      // Risk: like spamming users as if it was from this site
      'restrict access' => TRUE,
    ),
    'use mail debugger user' => array(
      'title' => t('Use mail debugger user'),
      // Risk: like sending confusing mails to site members
      'restrict access' => TRUE,
    ),
  );
}

Functions

Namesort descending Description
mail_debugger_common_mail Implement hook_mail()
mail_debugger_common_mail_debugger_info Implement hook_mail_debugger_info();
mail_debugger_common_menu Implement hook_menu();
mail_debugger_common_permission Implement hook_permission(); Define permission for using the module