updated node_export, mimemail, menu_attributes

This commit is contained in:
Bachir Soussi Chiadmi
2016-11-05 17:09:40 +01:00
parent 2b028cf376
commit fdefc824d8
50 changed files with 1598 additions and 1555 deletions

View File

@@ -6,9 +6,9 @@ dependencies[] = trigger
core = 7.x
; Information added by Drupal.org packaging script on 2014-03-05
version = "7.x-1.0-beta3"
; Information added by Drupal.org packaging script on 2015-08-02
version = "7.x-1.0-beta4"
core = "7.x"
project = "mimemail"
datestamp = "1394018015"
datestamp = "1438530555"

View File

@@ -24,7 +24,11 @@ function mimemail_action_info() {
*/
function mimemail_send_email_action($entity, $context) {
if (empty($context['node'])) {
$context['node'] = $entity;
if (get_class($entity) == 'OgMembership') {
$context['user'] = user_load($entity->etid);
} else {
$context['node'] = $entity;
}
}
$to = token_replace($context['to'], $context);

View File

@@ -145,7 +145,7 @@ class mimemail_compress {
// Convert float to align for images.
$float = preg_match ('/float:(left|right)/', $style, $matches);
if ($float) {
if ($node->nodeName == 'img' && $float) {
$node->setAttribute('align', $matches[1]);
$node->setAttribute('vspace', 5);
$node->setAttribute('hspace', 5);

View File

@@ -6,9 +6,9 @@ core = 7.x
files[] = mimemail_compress.inc
; Information added by Drupal.org packaging script on 2014-03-05
version = "7.x-1.0-beta3"
; Information added by Drupal.org packaging script on 2015-08-02
version = "7.x-1.0-beta4"
core = "7.x"
project = "mimemail"
datestamp = "1394018015"
datestamp = "1438530555"

View File

@@ -0,0 +1,12 @@
name = Mime Mail Example
description = Example of how to use the Mime Mail module.
dependencies[] = mimemail
package = Example modules
core = 7.x
; Information added by Drupal.org packaging script on 2015-08-02
version = "7.x-1.0-beta4"
core = "7.x"
project = "mimemail"
datestamp = "1438530555"

View File

@@ -0,0 +1,20 @@
<?php
/**
* @file
* Install, update and uninstall functions for Mime Mail Example module.
*/
/**
* Implements hook_enable().
*/
function mimemail_example_enable() {
mailsystem_set(array('mimemail_example' => 'MimeMailSystem'));
}
/**
* Implements hook_disable().
*/
function mimemail_example_disable() {
mailsystem_clear(array('mimemail_example' => 'MimeMailSystem'));
}

View File

@@ -0,0 +1,170 @@
<?php
/**
* @file
* Core and contrib hook implementations for Mime Mail Example module.
*/
/**
* Implements hook_menu().
*/
function mimemail_example_menu() {
$items['example/mimemail_example'] = array(
'title' => 'Mime Mail Example',
'page callback' => 'drupal_get_form',
'page arguments' => array('mimemail_example_form'),
'access arguments' => array('access content'),
);
return $items;
}
/**
* Implements hook_mail().
*/
function mimemail_example_mail($key, &$message, $params) {
$message['subject'] = $params['subject'];
$message['body'][] = $params['body'];
}
/**
* The example email contact form.
*/
function mimemail_example_form() {
global $user;
$form['intro'] = array(
'#markup' => t('Use this form to send a HTML message to an e-mail address. No spamming!'),
);
$form['key'] = array(
'#type' => 'textfield',
'#title' => t('Key'),
'#default_value' => 'test',
'#required' => TRUE,
);
$form['to'] = array(
'#type' => 'textfield',
'#title' => t('To'),
'#default_value' => $user->mail,
'#required' => TRUE,
);
$form['from'] = array(
'#type' => 'textfield',
'#title' => t('Sender name'),
);
$form['from_mail'] = array(
'#type' => 'textfield',
'#title' => t('Sender e-mail address'),
);
$form['params'] = array(
'#tree' => TRUE,
'headers' => array(
'Cc' => array(
'#type' => 'textfield',
'#title' => t('Cc'),
),
'Bcc' => array(
'#type' => 'textfield',
'#title' => t('Bcc'),
),
'Reply-to' => array(
'#type' => 'textfield',
'#title' => t('Reply to'),
),
'List-unsubscribe' => array(
'#type' => 'textfield',
'#title' => t('List-unsubscribe'),
),
),
'subject' => array(
'#type' => 'textfield',
'#title' => t('Subject'),
),
'body' => array(
'#type' => 'textarea',
'#title' => t('HTML message'),
),
'plain' => array(
'#type' => 'hidden',
'#states' => array(
'value' => array(
':input[name="body"]' => array('value' => ''),
),
),
),
'plaintext' => array(
'#type' => 'textarea',
'#title' => t('Plain text message'),
),
'attachments' => array(
'#name' => 'files[attachment]',
'#type' => 'file',
'#title' => t('Choose a file to send as attachment'),
),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Send message'),
);
return $form;
}
/**
* Form validation logic for the email contact form.
*/
function mimemail_example_form_validate($form, &$form_state) {
$values = &$form_state['values'];
if (!valid_email_address($values['to'])) {
form_set_error('to', t('That e-mail address is not valid.'));
}
$file = file_save_upload('attachment');
if ($file) {
$file = file_move($file, 'public://');
$values['params']['attachments'][] = array(
'filepath' => $file->uri,
);
}
}
/**
* Form submission logic for the email contact form.
*/
function mimemail_example_form_submit($form, &$form_state) {
$values = $form_state['values'];
$module = 'mimemail_example';
$key = $values['key'];
$to = $values['to'];
$language = language_default();
$params = $values['params'];
if (!empty($values['from_mail'])) {
module_load_include('inc', 'mimemail');
$from = mimemail_address(array(
'name' => $values['from'],
'mail' => $values['from_mail'],
));
}
else {
$from = $values['from'];
}
$send = TRUE;
$result = drupal_mail($module, $key, $to, $language, $params, $from, $send);
if ($result['result'] == TRUE) {
drupal_set_message(t('Your message has been sent.'));
}
else {
drupal_set_message(t('There was a problem sending your message and it was not sent.'), 'error');
}
}