updated mailgun, mailsystem, honeypot, googleanalitycs, features, content_taxonomy
This commit is contained in:
@@ -407,7 +407,8 @@ function _mailsystem_html_to_text(DOMNode $node, array $allowed_tags, array &$no
|
||||
// Copy each child node to output.
|
||||
if ($node->hasChildNodes()) {
|
||||
foreach ($node->childNodes as $child) {
|
||||
$child_text .= _mailsystem_html_to_text($child, $allowed_tags, $notes, $line_length - drupal_strlen($indent), $parents, $child_count); }
|
||||
$child_text .= _mailsystem_html_to_text($child, $allowed_tags, $notes, $line_length - drupal_strlen($indent), $parents, $child_count);
|
||||
}
|
||||
}
|
||||
// We only add prefix and suffix if the child nodes were non-empty.
|
||||
if ($child_text > '') {
|
||||
@@ -416,7 +417,7 @@ function _mailsystem_html_to_text(DOMNode $node, array $allowed_tags, array &$no
|
||||
$child_text = drupal_strtoupper($child_text);
|
||||
}
|
||||
// Don't add a newline to an existing newline.
|
||||
if ($suffix === $eol && drupal_substr($child_text, - drupal_strlen($eol)) === $eol) {
|
||||
if ($suffix === $eol && drupal_substr($child_text, -drupal_strlen($eol)) === $eol) {
|
||||
$suffix = '';
|
||||
}
|
||||
// Trim spaces around newlines except with <pre> or inline tags.
|
||||
@@ -496,7 +497,7 @@ function _mailsystem_html_to_text_table(DOMNode $node, $allowed_tags = NULL, arr
|
||||
$footer[] = $current;
|
||||
break;
|
||||
|
||||
default: // Either 'tbody' or 'table'
|
||||
default: // Either 'tbody' or 'table'.
|
||||
$body[] = $current;
|
||||
break;
|
||||
}
|
||||
@@ -647,7 +648,7 @@ function _mailsystem_html_to_text_table(DOMNode $node, $allowed_tags = NULL, arr
|
||||
}
|
||||
// Generate the row separator line.
|
||||
$separator = '+';
|
||||
for($i = 0; $i < $num_cols; $i++) {
|
||||
for ($i = 0; $i < $num_cols; $i++) {
|
||||
$separator .= str_repeat('-', $widths[$i]) . '+';
|
||||
}
|
||||
$separator .= $eol;
|
||||
|
@@ -4,6 +4,7 @@
|
||||
* @file
|
||||
* Administrative form for setting the mail_system variable.
|
||||
*/
|
||||
|
||||
function mailsystem_admin_settings() {
|
||||
$args = array(
|
||||
'!interface' => url('http://api.drupal.org/api/drupal/includes--mail.inc/interface/MailSystemInterface/7'),
|
||||
@@ -49,13 +50,13 @@ function mailsystem_admin_settings() {
|
||||
'#default_value' => $mail_system[mailsystem_default_id()],
|
||||
);
|
||||
$mailsystem_classes = array(
|
||||
mailsystem_default_id() => t('Remove this setting.')
|
||||
mailsystem_default_id() => t('Remove this setting.'),
|
||||
) + $mailsystem_classes;
|
||||
foreach (array_diff_key($mail_system, $mail_defaults) as $id => $class) {
|
||||
// Separate $id into $module and $key.
|
||||
$module = $id;
|
||||
while ($module && empty($descriptions[$module])) {
|
||||
// Remove a key from the end
|
||||
// Remove a key from the end.
|
||||
$module = implode('_', explode('_', $module, -1));
|
||||
}
|
||||
// If an array key of the $mail_system variable is neither "default-system"
|
||||
@@ -91,11 +92,11 @@ function mailsystem_admin_settings() {
|
||||
}
|
||||
}
|
||||
$form['mailsystem']['mailsystem_theme'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Theme to render the emails'),
|
||||
'#description' => t('Select the theme that will be used to render the emails. This can be either the current theme, the default theme, the domain theme or any active theme.'),
|
||||
'#options' => $theme_options,
|
||||
'#default_value' => variable_get('mailsystem_theme', 'current'),
|
||||
'#type' => 'select',
|
||||
'#title' => t('Theme to render the emails'),
|
||||
'#description' => t('Select the theme that will be used to render the emails. This can be either the current theme, the default theme, the domain theme or any active theme.'),
|
||||
'#options' => $theme_options,
|
||||
'#default_value' => variable_get('mailsystem_theme', 'current'),
|
||||
);
|
||||
$form['class'] = array(
|
||||
'#type' => 'fieldset',
|
||||
@@ -168,7 +169,7 @@ function mailsystem_admin_settings_submit($form, &$form_state) {
|
||||
empty($form_state['values'][$default_id])
|
||||
? mailsystem_default_value()
|
||||
: $form_state['values'][$default_id]
|
||||
)
|
||||
),
|
||||
);
|
||||
foreach (element_children($form_state['values']['mailsystem']) as $module) {
|
||||
$class = $form_state['values']['mailsystem'][$module];
|
||||
|
@@ -1,14 +1,12 @@
|
||||
package = Mail
|
||||
name = Mail System
|
||||
description = Provides a user interface for per-module and site-wide mail_system selection.
|
||||
php = 5.0
|
||||
core = 7.x
|
||||
configure = admin/config/system/mailsystem
|
||||
dependencies[] = filter
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-04-10
|
||||
version = "7.x-2.34"
|
||||
; Information added by Drupal.org packaging script on 2018-07-12
|
||||
version = "7.x-2.35"
|
||||
core = "7.x"
|
||||
project = "mailsystem"
|
||||
datestamp = "1334082653"
|
||||
|
||||
datestamp = "1531385928"
|
||||
|
@@ -132,15 +132,23 @@ function mailsystem_create_class($classes) {
|
||||
}
|
||||
$class_name = implode('__', $classes);
|
||||
// Ensure that the mailsystem directory exists.
|
||||
$class_dir = file_build_uri('mailsystem');
|
||||
if (!file_prepare_directory($class_dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
|
||||
// First we try the private filesystem.
|
||||
$private_files = variable_get('file_private_path', '');
|
||||
$private_files_full = $private_files . '/mailsystem';
|
||||
$public_files = variable_get('file_public_path', conf_path() . '/files');
|
||||
$public_files_full = $public_files . '/mailsystem';
|
||||
if ($private_files && file_prepare_directory($private_files_full, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
|
||||
$class_dir = $private_files . '/mailsystem';
|
||||
}
|
||||
// If private filesystem is not defined or writable, we use the public filesystem.
|
||||
elseif (file_prepare_directory($public_files_full, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
|
||||
$class_dir = $public_files . '/mailsystem';
|
||||
}
|
||||
else {
|
||||
return FALSE;
|
||||
}
|
||||
// Build the class filename.
|
||||
$class_file = drupal_realpath($class_dir) . DIRECTORY_SEPARATOR . "$class_name.mail.inc";
|
||||
// Strip DRUPAL_ROOT.
|
||||
$drupal_root = drupal_realpath(DRUPAL_ROOT) . DIRECTORY_SEPARATOR;
|
||||
$class_file = preg_replace('#^' . preg_quote($drupal_root, '#') . '#', '', $class_file);
|
||||
$class_file = $class_dir . DIRECTORY_SEPARATOR . "$class_name.mail.inc";
|
||||
// Build the class implementation as a string.
|
||||
$class_contents = '<?php
|
||||
class ' . $class_name . ' implements MailSystemInterface {';
|
||||
@@ -181,17 +189,19 @@ class ' . $class_name . ' implements MailSystemInterface {';
|
||||
$file_condition = db_and()
|
||||
->condition('filename', $class_file);
|
||||
db_delete('registry_file')
|
||||
->condition($file_condition);
|
||||
->condition($file_condition)
|
||||
->execute();
|
||||
db_delete('registry')->condition(
|
||||
db_or()->condition($class_condition)
|
||||
->condition($file_condition)
|
||||
);
|
||||
)->execute();
|
||||
// Make sure that registry functions are available.
|
||||
require_once 'includes/registry.inc';
|
||||
// Parse the newly-created class file and add it to the registry.
|
||||
_registry_parse_file($class_file, $class_contents, 'mailsystem');
|
||||
// Clear the mailsystem cache so that it will pick up the new class.
|
||||
// Clear the mailsystem caches so that it will pick up the new class.
|
||||
drupal_static_reset('mailsystem_get_classes');
|
||||
cache_clear_all('mailsystem_get_classes', 'cache');
|
||||
drupal_set_message(
|
||||
t('Class <code>%class</code> written to <code>%file</code>.',
|
||||
array('%class' => $class_name, '%file' => $class_file)
|
||||
@@ -257,7 +267,13 @@ function mailsystem_clear(array $setting) {
|
||||
* Returns a list of classes which implement MailSystemInterface.
|
||||
*/
|
||||
function &mailsystem_get_classes() {
|
||||
// Load static cache.
|
||||
$mailsystem_classes = &drupal_static(__FUNCTION__);
|
||||
// Check persistent cache if necessary.
|
||||
if (!isset($mailsystem_classes) && $cache = cache_get('mailsystem_get_classes')) {
|
||||
$mailsystem_classes = $cache->data;
|
||||
}
|
||||
// Load from db if no cache was hit.
|
||||
if (!isset($mailsystem_classes)) {
|
||||
$mailsystem_classes = array();
|
||||
// @todo Is there a better way to find all mail-related classes?
|
||||
@@ -282,14 +298,14 @@ function &mailsystem_get_classes() {
|
||||
->execute()
|
||||
->fetchAllKeyed();
|
||||
foreach ($mail_classes as $classname => $classfile) {
|
||||
if ( file_exists($classfile)
|
||||
if (file_exists($classfile)
|
||||
&& drupal_autoload_class($classname)
|
||||
) {
|
||||
$all_classes[$classname] = 1;
|
||||
}
|
||||
}
|
||||
foreach ($all_classes as $classname => $autoload) {
|
||||
if ( ($autoload || preg_match('/MailSystem/', $classname))
|
||||
if (($autoload || preg_match('/MailSystem/', $classname))
|
||||
&& ($object = new $classname)
|
||||
&& ($object instanceof MailSystemInterface)
|
||||
) {
|
||||
@@ -311,6 +327,8 @@ function &mailsystem_get_classes() {
|
||||
}
|
||||
}
|
||||
ksort($mailsystem_classes);
|
||||
// Store in persistent cache.
|
||||
cache_set('mailsystem_get_classes', $mailsystem_classes, 'cache', CACHE_TEMPORARY);
|
||||
}
|
||||
return $mailsystem_classes;
|
||||
}
|
||||
@@ -324,10 +342,10 @@ function mailsystem_theme_registry_alter(&$theme_registry) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the key of the theme used to render the emails.
|
||||
*
|
||||
* @todo Add some kind of hook to let other modules alter this behavior.
|
||||
*/
|
||||
* Retrieves the key of the theme used to render the emails.
|
||||
*
|
||||
* @todo Add some kind of hook to let other modules alter this behavior.
|
||||
*/
|
||||
function mailsystem_get_mail_theme() {
|
||||
global $theme_key;
|
||||
$theme = variable_get('mailsystem_theme', 'current');
|
||||
@@ -335,9 +353,11 @@ function mailsystem_get_mail_theme() {
|
||||
case 'default':
|
||||
$theme = variable_get('theme_default', NULL);
|
||||
break;
|
||||
|
||||
case 'current':
|
||||
$theme = $theme_key;
|
||||
break;
|
||||
|
||||
case 'domain':
|
||||
// Fetch the theme for the current domain.
|
||||
if (module_exists('domain_theme')) {
|
||||
|
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* The theme system, which controls the output of email messages.
|
||||
*/
|
||||
* @file
|
||||
* The theme system, which controls the output of email messages.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_theme_registry_alter().
|
||||
*/
|
||||
* Implements hook_theme_registry_alter().
|
||||
*/
|
||||
function mailsystem_theme_theme_registry_alter(&$theme_registry) {
|
||||
global $theme_key;
|
||||
static $recursion_prevention = FALSE;
|
||||
@@ -26,6 +26,10 @@ function mailsystem_theme_theme_registry_alter(&$theme_registry) {
|
||||
if (isset($themes[$mailsystem_theme])) {
|
||||
$theme = clone $themes[$mailsystem_theme];
|
||||
if (isset($theme)) {
|
||||
// Swap to the mailsystem theme.
|
||||
$old_theme = $theme_key;
|
||||
mailsystem_theme_swap_theme($mailsystem_theme);
|
||||
|
||||
// Establish variables for further processing.
|
||||
$base_theme = array();
|
||||
if (isset($theme->base_themes)) {
|
||||
@@ -42,10 +46,10 @@ function mailsystem_theme_theme_registry_alter(&$theme_registry) {
|
||||
|
||||
// Include template files to let _theme_load_registry add preprocess
|
||||
// functions.
|
||||
include_once(drupal_get_path('theme', $theme->name) . '/template.php');
|
||||
foreach ($base_theme as $base) {
|
||||
include_once(drupal_get_path('theme', $base->name) . '/template.php');
|
||||
include_once drupal_get_path('theme', $base->name) . '/template.php';
|
||||
}
|
||||
include_once drupal_get_path('theme', $theme->name) . '/template.php';
|
||||
|
||||
// Get the theme_registry cache.
|
||||
$cache = _theme_load_registry($theme, $base_theme, $theme_engine);
|
||||
@@ -75,8 +79,46 @@ function mailsystem_theme_theme_registry_alter(&$theme_registry) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Swap back to the original theme.
|
||||
mailsystem_theme_swap_theme($old_theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
$recursion_prevention = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to swap themes safely for use by mailsystem_theme_theme_registry_alter().
|
||||
*/
|
||||
function mailsystem_theme_swap_theme($new_theme) {
|
||||
// Make sure the theme exists.
|
||||
$themes = list_themes();
|
||||
if (empty($themes[$new_theme])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Both theme/theme_key are set to the new theme.
|
||||
global $theme, $theme_key;
|
||||
$theme = $theme_key = $new_theme;
|
||||
|
||||
// Create the base_theme_info.
|
||||
global $base_theme_info;
|
||||
$base_theme = array();
|
||||
$ancestor = $theme;
|
||||
while ($ancestor && isset($themes[$ancestor]->base_theme)) {
|
||||
$ancestor = $themes[$ancestor]->base_theme;
|
||||
$base_theme[] = $themes[$ancestor];
|
||||
}
|
||||
$base_theme_info = array_reverse($base_theme);
|
||||
|
||||
// Some other theme related globals.
|
||||
global $theme_engine, $theme_info, $theme_path;
|
||||
$theme_engine = $themes[$theme]->engine;
|
||||
$theme_info = $themes[$theme];
|
||||
$theme_path = dirname($themes[$theme]->filename);
|
||||
|
||||
// We need to reset the drupal_alter and module_implements statics.
|
||||
drupal_static_reset('drupal_alter');
|
||||
drupal_static_reset('module_implements');
|
||||
}
|
||||
|
Reference in New Issue
Block a user