Version Description
- Fixed image block width for small images or specific width
Download this release
Release Info
Developer | satollo |
Plugin | Newsletter |
Version | 7.5.0 |
Comparing to | |
See all releases |
Code changes from version 7.4.9 to 7.5.0
- emails/blocks/image/block.php +82 -78
- plugin.php +2 -2
- readme.txt +5 -1
emails/blocks/image/block.php
CHANGED
@@ -1,78 +1,82 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Name: Single image
|
4 |
-
* Section: content
|
5 |
-
* Description: A single image with link
|
6 |
-
*/
|
7 |
-
|
8 |
-
/* @var $options array */
|
9 |
-
/* @var $wpdb wpdb */
|
10 |
-
|
11 |
-
$defaults = array(
|
12 |
-
'image' => '',
|
13 |
-
'image-alt' => '',
|
14 |
-
'url' => '',
|
15 |
-
'width' => 0,
|
16 |
-
'align' => 'center',
|
17 |
-
'block_background' => '',
|
18 |
-
'block_padding_left' => 0,
|
19 |
-
'block_padding_right' => 0,
|
20 |
-
'block_padding_bottom' => 15,
|
21 |
-
'block_padding_top' => 15
|
22 |
-
);
|
23 |
-
|
24 |
-
$options = array_merge($defaults, $options);
|
25 |
-
|
26 |
-
if (empty($options['image']['id'])) {
|
27 |
-
if (!empty($options['image-url'])) {
|
28 |
-
$media = new TNP_Media();
|
29 |
-
$media->url = $options['image-url'];
|
30 |
-
} else {
|
31 |
-
$media = new TNP_Media();
|
32 |
-
// A placeholder can be set by a preset and it is kept indefinitely
|
33 |
-
if (!empty($options['placeholder'])) {
|
34 |
-
$media->url = $options['placeholder'];
|
35 |
-
$media->width = 600;
|
36 |
-
$media->height = 250;
|
37 |
-
} else {
|
38 |
-
$media->url = 'https://source.unsplash.com/1200x500/daily';
|
39 |
-
$media->width = 600;
|
40 |
-
$media->height = 250;
|
41 |
-
}
|
42 |
-
}
|
43 |
-
} else {
|
44 |
-
$media = tnp_resize_2x($options['image']['id'], [600, 0]);
|
45 |
-
// Should never happen but... it happens
|
46 |
-
if (!$media) {
|
47 |
-
echo 'The selected media file cannot be processed';
|
48 |
-
return;
|
49 |
-
}
|
50 |
-
}
|
51 |
-
|
52 |
-
if (!empty($options['width'])) {
|
53 |
-
$media->set_width($options['width']);
|
54 |
-
}
|
55 |
-
$media->link = $options['url'];
|
56 |
-
$media->alt = $options['image-alt'];
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
echo '
|
69 |
-
|
70 |
-
echo '
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Name: Single image
|
4 |
+
* Section: content
|
5 |
+
* Description: A single image with link
|
6 |
+
*/
|
7 |
+
|
8 |
+
/* @var $options array */
|
9 |
+
/* @var $wpdb wpdb */
|
10 |
+
|
11 |
+
$defaults = array(
|
12 |
+
'image' => '',
|
13 |
+
'image-alt' => '',
|
14 |
+
'url' => '',
|
15 |
+
'width' => 0,
|
16 |
+
'align' => 'center',
|
17 |
+
'block_background' => '',
|
18 |
+
'block_padding_left' => 0,
|
19 |
+
'block_padding_right' => 0,
|
20 |
+
'block_padding_bottom' => 15,
|
21 |
+
'block_padding_top' => 15
|
22 |
+
);
|
23 |
+
|
24 |
+
$options = array_merge($defaults, $options);
|
25 |
+
|
26 |
+
if (empty($options['image']['id'])) {
|
27 |
+
if (!empty($options['image-url'])) {
|
28 |
+
$media = new TNP_Media();
|
29 |
+
$media->url = $options['image-url'];
|
30 |
+
} else {
|
31 |
+
$media = new TNP_Media();
|
32 |
+
// A placeholder can be set by a preset and it is kept indefinitely
|
33 |
+
if (!empty($options['placeholder'])) {
|
34 |
+
$media->url = $options['placeholder'];
|
35 |
+
$media->width = 600;
|
36 |
+
$media->height = 250;
|
37 |
+
} else {
|
38 |
+
$media->url = 'https://source.unsplash.com/1200x500/daily';
|
39 |
+
$media->width = 600;
|
40 |
+
$media->height = 250;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
} else {
|
44 |
+
$media = tnp_resize_2x($options['image']['id'], [600, 0]);
|
45 |
+
// Should never happen but... it happens
|
46 |
+
if (!$media) {
|
47 |
+
echo 'The selected media file cannot be processed';
|
48 |
+
return;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
if (!empty($options['width'])) {
|
53 |
+
$media->set_width($options['width']);
|
54 |
+
}
|
55 |
+
$media->link = $options['url'];
|
56 |
+
$media->alt = $options['image-alt'];
|
57 |
+
|
58 |
+
echo '<table width="100%"><tr><td align="', esc_attr($options['align']), '">';
|
59 |
+
|
60 |
+
if ($media->link) {
|
61 |
+
echo '<a href="', esc_attr($media->link), '" target="_blank" rel="noopener nofollow" style="display: block; font-size: 0; text-decoration: none; line-height: normal!important">';
|
62 |
+
} else {
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
echo '<img src="', esc_attr($media->url), '" width="', esc_attr($media->width), '"';
|
67 |
+
if ($media->height) {
|
68 |
+
echo ' height="', esc_attr($media->height), '"';
|
69 |
+
}
|
70 |
+
echo ' alt="', esc_attr($media->alt), '"';
|
71 |
+
// The font size is important for the alt text
|
72 |
+
echo ' border="0" style="display: block; max-width: ', esc_attr($media->width), 'px !important; width: 100%; padding: 0; border: 0; font-size: 12px"';
|
73 |
+
echo '>';
|
74 |
+
|
75 |
+
if ($media->link) {
|
76 |
+
echo '</a>';
|
77 |
+
} else {
|
78 |
+
}
|
79 |
+
|
80 |
+
echo '</td></tr></table>';
|
81 |
+
?>
|
82 |
+
|
plugin.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Newsletter
|
5 |
Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
|
6 |
Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
|
7 |
-
Version: 7.
|
8 |
Author: Stefano Lissa & The Newsletter Team
|
9 |
Author URI: https://www.thenewsletterplugin.com
|
10 |
Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
|
@@ -37,7 +37,7 @@ if (version_compare(phpversion(), '5.6', '<')) {
|
|
37 |
return;
|
38 |
}
|
39 |
|
40 |
-
define('NEWSLETTER_VERSION', '7.
|
41 |
|
42 |
global $newsletter, $wpdb;
|
43 |
|
4 |
Plugin Name: Newsletter
|
5 |
Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
|
6 |
Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
|
7 |
+
Version: 7.5.0
|
8 |
Author: Stefano Lissa & The Newsletter Team
|
9 |
Author URI: https://www.thenewsletterplugin.com
|
10 |
Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
|
37 |
return;
|
38 |
}
|
39 |
|
40 |
+
define('NEWSLETTER_VERSION', '7.5.0');
|
41 |
|
42 |
global $newsletter, $wpdb;
|
43 |
|
readme.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
=== Newsletter - Send awesome emails from WordPress ===
|
2 |
Tags: newsletter, email marketing, welcome email, signup forms, lead generation, marketing automation
|
3 |
Tested up to: 6.0
|
4 |
-
Stable tag: 7.
|
5 |
Contributors: satollo,webagile,michael-travan
|
6 |
License: GPLv2 or later
|
7 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -126,6 +126,10 @@ Thank you, The Newsletter Team
|
|
126 |
|
127 |
== Changelog ==
|
128 |
|
|
|
|
|
|
|
|
|
129 |
= 7.4.9 =
|
130 |
|
131 |
* Composer fix not updating new newsletters
|
1 |
=== Newsletter - Send awesome emails from WordPress ===
|
2 |
Tags: newsletter, email marketing, welcome email, signup forms, lead generation, marketing automation
|
3 |
Tested up to: 6.0
|
4 |
+
Stable tag: 7.5.0
|
5 |
Contributors: satollo,webagile,michael-travan
|
6 |
License: GPLv2 or later
|
7 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
126 |
|
127 |
== Changelog ==
|
128 |
|
129 |
+
= 7.5.0 =
|
130 |
+
|
131 |
+
* Fixed image block width for small images or specific width
|
132 |
+
|
133 |
= 7.4.9 =
|
134 |
|
135 |
* Composer fix not updating new newsletters
|