<?php class embedremoteimages extends phplistPlugin { public $name = 'Embed remote images, sendformat'; public $coderoot = ''; public $version = '0.1'; public $authors = 'Michiel Dethmers'; public $enabled = 1; public $description = 'Allow choosing embed remote images per campaign'; public $documentationUrl = 'https://resources.phplist.com/plugin/embedremoteimages'; public $settings = array( ); public function adminmenu() { return array(); } public function sendFormats() { return array('embedremoteimages' => s('HTML, with remote images embedded')); } public function parseFinalMessage($sendformat, $htmlmessage, $textmessage, &$mail, $messageid) { if ($sendformat != 'embedremoteimages') return 0; global $cached; $mail->add_html($htmlmessage, $textmessage, $cached[$messageid]['templateid']); ## taken from class.phplistmailer.php $external_images = array(); $extensions = implode('|', array_keys($mail->image_types)); $matched_images = array(); $pattern = sprintf( '~="(https?://(?!%s)([^"]+\.(%s))([\\?/][^"]+)?)"~Ui', preg_quote(getConfig('website')), $extensions ); preg_match_all($pattern, $mail->Body, $matched_images); for ($i = 0; $i < count($matched_images[1]); ++$i) { if ($mail->external_image_exists($matched_images[1][$i])) { $external_images[] = $matched_images[1][$i].'~^~'.basename($matched_images[2][$i]).'~^~'.strtolower($matched_images[3][$i]); } } if (!empty($external_images)) { $external_images = array_unique($external_images); for ($i = 0; $i < count($external_images); ++$i) { $external_image = explode('~^~', $external_images[$i]); if ($image = $mail->get_external_image($external_image[0])) { $content_type = $mail->image_types[$external_image[2]]; $cid = $mail->add_html_image($image, $external_image[1], $content_type); if (!empty($cid)) { $mail->Body = str_replace($external_image[0], 'cid:'.$cid, $mail->Body); } } } } return 1; } public function dependencyCheck() { global $plugins; return array( 'EMBEDEXTERNALIMAGES should not be enabled' => empty(EMBEDEXTERNALIMAGES), ); } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
CKEditorPlugin | Folder | 0755 |
|
|
CaptchaPlugin | Folder | 0755 |
|
|
Common | Folder | 0755 |
|
|
CommonPlugin | Folder | 0755 |
|
|
SegmentPlugin | Folder | 0755 |
|
|
UpdaterPlugin | Folder | 0755 |
|
|
fckphplist | Folder | 0755 |
|
|
.htaccess | File | 462 B | 0644 |
|
CKEditorPlugin.php | File | 15.15 KB | 0644 |
|
COPYING.txt | File | 34.32 KB | 0644 |
|
CaptchaPlugin.php | File | 8.85 KB | 0644 |
|
CommonPlugin.php | File | 6.63 KB | 0644 |
|
SegmentPlugin.php | File | 17.99 KB | 0644 |
|
UpdaterPlugin.php | File | 2.04 KB | 0644 |
|
campaignslicer.php | File | 4.44 KB | 0644 |
|
dateplaceholder.php | File | 4.77 KB | 0644 |
|
disposablemailblock.php | File | 9.69 KB | 0644 |
|
domainthrottlemap.php | File | 12.41 KB | 0644 |
|
embedremoteimages.php | File | 2.49 KB | 0644 |
|
fckphplist.php | File | 2.74 KB | 0644 |
|
inviteplugin.php | File | 3.89 KB | 0644 |
|
subjectLinePlaceholdersPlugin.php | File | 5.27 KB | 0644 |
|
update.sh | File | 66 B | 0644 |
|