first commit

This commit is contained in:
2024-07-15 11:28:08 +02:00
commit f52d538ea5
21891 changed files with 6161164 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<?php
/*
* Name: Company Info
* Section: footer
* Description: Company Info for Can-Spam act requirements
*/
$default_options = array(
'block_background' => '#ffffff',
'font_family' => $font_family,
'font_size' => 13,
'font_color' => '#999999',
'font_weight' => 'normal',
'block_padding_top' => 15,
'block_padding_bottom' => 15,
'block_padding_left' => 15,
'block_padding_right' => 15
);
$options = array_merge($default_options, $options);
?>
<style>
.canspam-text {
padding: 10px;
text-align: center;
font-size: <?php echo $options['font_size'] ?>px;
font-family: <?php echo $options['font_family'] ?>;
font-weight: <?php echo $options['font_weight'] ?>;
color: <?php echo $options['font_color'] ?>;
}
</style>
<table width="100%" style="width: 100%!important" border="0" cellspacing="0" cellpadding="0" align="center" class="responsive-table">
<tr>
<td align="center" class="canspam-text">
<?php echo!empty($block_options['footer_title']) ? $block_options['footer_title'] : 'Your Company' ?>
<br>
<?php echo!empty($block_options['footer_contact']) ? $block_options['footer_contact'] : 'Company Address, Phone Number' ?>
<br>
<em><?php echo!empty($block_options['footer_legal']) ? $block_options['footer_legal'] : 'Copyright or Legal text' ?></em>
</div>
</td>
</tr>
</table>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,9 @@
<?php
/* @var $fields NewsletterFields */
?>
<p>Company data can be globally set on company info panel.</p>
<?php $fields->font() ?>
<?php $fields->block_commons() ?>

View File

@@ -0,0 +1,54 @@
<?php
/*
* Name: Call To Action
* Section: content
* Description: Call to action button
*/
$default_options = array(
'text' => 'Call to action',
'background' => '#256F9C',
'font_color' => '#ffffff',
'url' => home_url(),
'font_family' => $font_family,
'font_size' => 16,
'font_weight' => 'normal',
'block_background' => '#ffffff',
'width' => '200',
'block_padding_top' => 20,
'block_padding_bottom' => 20,
);
$options = array_merge($default_options, $options);
?>
<style>
.cta-button {
font-size: <?php echo $options['font_size'] ?>px;
font-family: <?php echo $options['font_family'] ?>;
font-weight: <?php echo $options['font_weight'] ?>;
color: <?php echo $options['font_color'] ?>;
text-decoration: none;
background-color: <?php echo $options['background'] ?>;
line-height: normal;
border-top: 15px solid <?php echo $options['background'] ?>;
border-bottom: 15px solid <?php echo $options['background'] ?>;
border-left: 25px solid <?php echo $options['background'] ?>;
border-right: 25px solid <?php echo $options['background'] ?>;
width: <?php echo $options['width'] ?>px;
max-width: 100%;
box-sizing: border-box;
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
display: inline-block;
}
</style>
<a href="<?php echo $options['url'] ?>" target="_blank" rel="noopener" class="cta-button"><?php echo $options['text'] ?></a>
<div itemscope="" itemtype="http://schema.org/EmailMessage">
<div itemprop="potentialAction" itemscope="" itemtype="http://schema.org/ViewAction">
<meta itemprop="url" content="<?php echo esc_attr($options['url']) ?>" />
<meta itemprop="name" content="<?php echo esc_attr($options['text']) ?>" />
</div>
<meta itemprop="description" content="<?php echo esc_attr($options['text']) ?>" />
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -0,0 +1,12 @@
<?php
/* @var $fields NewsletterFields */
?>
<?php $fields->text('text', 'Button label') ?>
<?php $fields->url('url', 'Button URL') ?>
<?php $fields->font('font', __('Font', 'newsletter')) ?>
<?php $fields->color('background', 'Button background') ?>
<?php $fields->size('width', __('Width', 'newsletter')) ?>
<?php $fields->block_commons() ?>

View File

@@ -0,0 +1,45 @@
<?php
/*
* Name: Footer
* Section: footer
* Description: View online ad profile links
*/
$default_options = array(
'view' => 'View online',
'profile' => 'Modify your subscription',
'block_background' => '#ffffff',
'font_family' => $font_family,
'font_size' => 13,
'font_color' => '#444444',
'font_weight' => 'normal',
'block_padding_left' => 15,
'block_padding_right' => 15,
'block_padding_bottom' => 15,
'block_padding_top' => 15
);
$options = array_merge($default_options, $options);
?>
<style>
.footer-text {
font-size: <?php echo $options['font_size'] ?>px;
font-family: <?php echo $options['font_family'] ?>;
font-weight: <?php echo $options['font_weight'] ?>;
color: <?php echo $options['font_color'] ?>;
text-decoration: none;
}
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
<a class="footer-text" href="{profile_url}"><?php echo $options['profile'] ?></a>
<span class="footer-text">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</span>
<a class="footer-text" href="{email_url}"><?php echo $options['view'] ?></a>
</td>
</tr>
</table>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1,11 @@
<?php
/* @var $fields NewsletterFields */
?>
<?php $fields->text('view', 'View online label') ?>
<?php $fields->text('profile', 'Subscription details label') ?>
<?php $fields->font() ?>
<?php $fields->block_commons() ?>

View File

@@ -0,0 +1,36 @@
<?php
/*
* Name: Giphy
* Section: content
* Description: Add a Giphy image
*
*/
/* @var $options array */
/* @var $wpdb wpdb */
$default_options = array(
'view'=>'View online',
'text'=>'Few words summary',
'block_background'=>'#ffffff',
'font_family'=>$font_family,
'font_size'=>13,
'color'=>'#999999',
'block_padding_top'=>15,
'block_padding_bottom'=>15,
'block_padding_left'=>0,
'block_padding_right'=>0
);
$options = array_merge($default_options, $options);
?>
<table width="100%" border="0" cellpadding="0" align="center" cellspacing="0">
<tr>
<td width="100%" valign="top" align="center">
<img src="<?php echo $options['giphy_url'] ?>" style="max-width: 100%!important; height: auto!important;" />
</td>
</tr>
</table>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -0,0 +1,50 @@
<?php
/*
* @var $options array contains all the options the current block we're ediging contains
* @var $controls NewsletterControls
*/
?>
<?php $fields->text('q', __('Search')) ?>
<div style="clear: both; max-height: 300px; overflow: scroll; margin-bottom: 15px" id="tnp-giphy-results"></div>
<?php $controls->hidden('giphy_url') ?>
<div id="giphy-preview">
<?php if (!empty($controls->data['giphy_url'])) { ?>
<img src="<?php echo esc_attr($controls->data['giphy_url'])?>" style="max-width: 300px">
<?php } ?>
</div>
<?php $fields->block_commons() ?>
<script type="text/javascript">
function choose_gif(url) {
//jQuery("#tnp-giphy-results").html("");
jQuery("#options-giphy_url").val(url);
jQuery("#giphy-preview").html('<img src="' + url + '" style="max-width: 300px">');
jQuery("#options-giphy_url").trigger("change");
}
jQuery("#options-q").keyup(
function () {
if (typeof(tid) != "undefined") {
window.clearTimeout(tid);
}
tid = window.setTimeout(function () {
var rating = "r";
var limit = 20;
var offset = 0;
jQuery.get("https://api.giphy.com/v1/gifs/search", {limit: limit, rating: rating, api_key: "57FLbVJJd7oQBZ0fEiRnzhM2VtZp5OP1", q: jQuery("#options-q").val()}, function (data) {
jQuery("#tnp-giphy-results").html("");
jQuery.each(data.data, function (index, value) {
jQuery("#tnp-giphy-results").append('<div style="overflow: hidden; width: 120px; height: 120px; float: left; margin: 5px"><img src="' + value.images.fixed_width_small.url + '" onclick="choose_gif(\'' + value.images.fixed_height.url + '\')" style="float:left; max-width: 100%"></div>');
});
}, "json");
}, 500);
});
jQuery("#options-q").trigger('keyup');
</script>

View File

@@ -0,0 +1,75 @@
<?php
/*
* Name: Header
* Section: header
* Description: Default header with company info
*/
$default_options = array(
'font_family' => $font_family,
'font_size' => 14,
'font_color' => '#444444',
'font_weight' => 'normal',
'block_background' => '#ffffff',
'block_padding_top'=>15,
'block_padding_bottom'=>15,
'block_padding_left'=>15,
'block_padding_right'=>15
);
$options = array_merge($default_options, $options);
if (empty($info['header_logo']['id'])) {
$image = false;
} else {
$image = tnp_media_resize($info['header_logo']['id'], array(200, 80));
if (is_wp_error($image)) {
$image = false;
}
}
$empty = empty($info['header_logo']['id']) && empty($info['header_sub']) && empty($info['header_title']);
?>
<?php if ($empty) { ?>
<p>Please, set your company info.</p>
<?php } else { ?>
<style>
.header-text {
padding: 10px;
text-align: right;
font-size: <?php echo $options['font_size'] ?>px;
font-family: <?php echo $options['font_family'] ?>;
font-weight: <?php echo $options['font_weight'] ?>;
color: <?php echo $options['font_color'] ?>;
}
.header-logo {
font-family: <?php echo $options['font_family'] ?>;
font-size: <?php echo $options['font_size']*1.1 ?>px;
line-height: normal;
font-weight: <?php echo $options['font_weight'] ?>;
color: <?php echo $options['font_color'] ?>;
}
</style>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<?php if ( $image ) { ?>
<td align="left" width="50%" inline-class="header-logo">
<a href="#" target="_blank">
<img alt="<?php echo esc_attr( $info['header_title'] ) ?>" src="<?php echo $image ?>"
style="display: block; max-width: 100%" border="0">
</a>
<?php } else { ?>
<td align="left" width="50%" inline-class="heading-text"
style="padding: 5px; font-size: 24px; font-family: Helvetica, Arial, sans-serif; font-weight: bold; color: #444444;">
<?php echo esc_attr( $info['header_title'] ) ?>
<?php } ?>
</td>
<td width="50%" align="right" class="mobile-hide" inline-class="header-text">
<?php echo $info['header_sub'] ?>
</td>
</tr>
</table>
<?php } ?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,11 @@
<?php
/* @var $options array contains all the options the current block we're ediging contains */
/* @var $controls NewsletterControls */
/* @var $controls NewsletterFields */
?>
<p>This block uses the <a href="?page=newsletter_main_info" target="_blank">global company info</a>.</p>
<?php $fields->font()?>
<?php $fields->block_commons() ?>

View File

@@ -0,0 +1,11 @@
.header-logo {
text-align: center!important;
}
@media all and (max-width: 640) {
.header-table td {
width: 100%!important;
}
.header-logo {
text-align: center!important;
}
}

View File

@@ -0,0 +1,43 @@
<?php
/*
* Name: Heading
* Section: content
* Description: Section title
*/
$default_options = array(
'text' => 'An Awesome Title',
'align' => 'center',
'block_background' => '#ffffff',
'font_family' => $font_family,
'font_size' => 30,
'font_color' => '#444444',
'font_weight' => 'normal',
'block_padding_left' => 15,
'block_padding_right' => 15,
'block_padding_bottom' => 15,
'block_padding_top' => 15
);
$options = array_merge($default_options, $options);
?>
<style>
.heading-text {
padding: 10px;
text-align: <?php echo $options['align'] ?>;
font-size: <?php echo $options['font_size'] ?>px;
font-family: <?php echo $options['font_family'] ?>;
font-weight: <?php echo $options['font_weight'] ?>;
color: <?php echo $options['font_color'] ?>;
}
</style>
<table border="0" cellpadding="0" cellspacing="0" width="100%" >
<tr>
<td align="center" class="heading-text">
<?php echo $options['text'] ?>
</td>
</tr>
</table>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,10 @@
<?php
/* @var $fields NewsletterFields */
?>
<?php $fields->text('text', __('Text', 'newsletter')) ?>
<?php $fields->font() ?>
<?php $fields->select('align', 'Alignment', array('center'=>'Center', 'left'=>'Left', 'right'=>'Right')) ?>
<?php $fields->block_commons() ?>

View File

@@ -0,0 +1,238 @@
<?php
/*
* Name: Last posts
* Section: content
* Description: Last opsts list with different layouts
*/
/* @var $options array */
/* @var $wpdb wpdb */
$defaults = array(
'button_url' => '',
'title' => 'An Awesome Title',
'text' => 'This is just a simple text you should change',
'font_family' => 'Helvetica, Arial, sans-serif',
'font_size' => '14',
'font_weight' => 'normal',
'font_color' => '#000000',
'title_font_family' => 'Helvetica, Arial, sans-serif',
'title_font_size' => '20',
'title_font_weight' => 'normal',
'title_font_color' => '#000000',
'block_background' => '#ffffff',
'layout' => 'full',
'button_label' => 'Click Here',
'button_color' => '#ffffff',
'button_background' => '#256F9C',
'layout' => 'full',
'block_padding_top'=>20,
'block_padding_bottom'=>20
);
$options = array_merge($defaults, $options);
$layout = $options['layout'];
if ($layout == 'full') {
$options = array_merge(array('block_padding_left'=>0, 'block_padding_right'=>0), $options);
} else {
$options = array_merge(array('block_padding_left'=>15, 'block_padding_right'=>15), $options);
}
$url = $options['button_url'];
$font_family = $options['font_family'];
$font_size = $options['font_size'];
$font_weight = $options['font_weight'];
$font_color = $options['font_color'];
$title_font_family = $options['title_font_family'];
$title_font_size = $options['title_font_size'];
$title_font_weight = $options['title_font_weight'];
$title_font_color = $options['title_font_color'];
$button_color = $options['button_color'];
$button_background = $options['button_background'];
$button_label = $options['button_label'];
$layout = $options['layout'];
if (!empty($options['image']['id'])) {
if ($layout == 'full') {
$image = tnp_media_resize($options['image']['id'], array(600, 0));
} else {
$image = tnp_media_resize($options['image']['id'], array(300, 200, true));
}
} else {
$image = false;
}
?>
<?php if ($layout == 'full') { ?>
<style>
.hero-title {
font-size: <?php echo $title_font_size ?>px;
color: <?php echo $title_font_color ?>;
padding-top: 30px;
font-family: <?php echo $title_font_family ?>;
font-weight: <?php echo $title_font_weight ?>;
}
.hero-text {
padding: 20px 0 0 0;
font-size: <?php echo $font_size ?>px;
line-height: 150%;
color: <?php echo $font_color ?>;
font-family: <?php echo $font_family ?>;
}
.hero-button-table {
background-color: <?php echo $button_background ?>;
/*border:1px solid #353535;*/
border-radius:5px;
}
.hero-button-td {
color: <?php echo $button_color ?>;
font-family:<?php echo $font_family ?>;
font-size:16px;
font-weight:normal;
letter-spacing:-.5px;
line-height:150%;
padding-top:15px;
padding-right:30px;
padding-bottom:15px;
padding-left:30px;
}
.hero-button-a {
color:<?php echo $button_color ?>;
text-decoration:none;
}
.hero-image {
max-width: 100%!important;
display: block;
border: 0px;
}
</style>
<!-- HERO IMAGE -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="padding-copy tnpc-row-edit">
<a href="<?php echo $url ?>" target="_blank" rel="noopener nofollow">
<img src="<?php echo $image ?>" border="0" alt="Image" inline-class="hero-image">
</a>
</td>
</tr>
<tr>
<td>
<!-- COPY -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" inline-class="hero-title">
<span><?php echo $options['title'] ?></span>
</td>
</tr>
<tr>
<td align="center" inline-class="hero-text">
<span><?php echo $options['text'] ?></span>
</td>
</tr>
<tr>
<td align="center">
<br>
<table border="0" cellpadding="0" cellspacing="0" inline-class="hero-button-table" align="center">
<tr>
<td align="center" valign="middle" inline-class="hero-button-td">
<a href="<?php echo esc_attr($url) ?>" target="_blank" inline-class="hero-button-a"><?php echo $button_label ?></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php } ?>
<?php if ($layout == 'left') { ?>
<style>
.hero-title {
font-size: <?php echo $title_font_size ?>px;
color: #333333;
padding-top: 0;
font-family: <?php echo $title_font_family ?>;
font-weight: <?php echo $title_font_weight ?>;
}
.hero-text {
padding: 20px 0 0 0;
font-size: <?php echo $font_size ?>px;
line-height: 150%;
color: #666666;
font-family: <?php echo $font_family ?>;
font-weight: <?php echo $font_weight ?>;
}
.hero-button-table {
background-color: <?php echo $button_background ?>;
/*border:1px solid #353535;*/
border-radius:5px;
}
.hero-button-td {
color: <?php echo $button_color ?>;
font-family:<?php echo $font_family ?>;
font-size:<?php echo $font_size ?>px;
font-weight:bold;
letter-spacing:-.5px;
line-height:150%;
padding-top:10px;
padding-right:30px;
padding-bottom:10px;
padding-left:30px;
}
.hero-button-a {
color:<?php echo $button_color ?>;
text-decoration:none;
}
</style>
<table width="290" align="left" class="hero-table">
<tr>
<td align="center" valign="top">
<img src="<?php echo $image ?>" border="0" alt="" style="max-width: 100%!important; height: auto!important; display: block;" class="img-max">
</td>
</tr>
</table>
<table width="290" align="right" class="hero-table hero-table-right">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" inline-class="hero-title">
<span><?php echo $options['title'] ?></span>
</td>
</tr>
<tr>
<td align="center" inline-class="hero-text">
<span><?php echo $options['text'] ?></span>
</td>
</tr>
</table>
<br>
<table border="0" cellpadding="0" cellspacing="0" align="center" inline-class="hero-button-table">
<tr>
<td align="center" valign="middle" inline-class="hero-button-td">
<a href="<?php echo esc_attr($url) ?>" target="_blank" inline-class="hero-button-a"><?php echo $button_label ?></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php } ?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,21 @@
<?php
/*
* @var $options array contains all the options the current block we're ediging contains
* @var $controls NewsletterControls
*/
/* @var $fields NewsletterFields */
?>
<?php $fields->select('layout', __('Layout', 'newsletter'), array('full' => 'Full', 'left' => 'Left'))?>
<?php $fields->media('image', __('Image', 'newsletter'))?>
<?php $fields->text('title', __('Title', 'newsletter')) ?>
<?php $fields->font('title_font')?>
<?php $fields->textarea('text', __('Text', 'newsletter')) ?>
<?php $fields->font('font')?>
<?php $fields->button('button', __('Button', 'newsletter'))?>
<?php $fields->block_commons() ?>

View File

@@ -0,0 +1,10 @@
@media all and (max-width: 525px) {
.hero-table {
width: 100%!important;
max-width: 100%!important;
}
.hero-table-right {
margin-top: 20px;
}
}

View File

@@ -0,0 +1,38 @@
<?php
/*
* Name: Html
* Section: content
* Description: Free HTML block
*
*/
/* @var $options array */
/* @var $wpdb wpdb */
$default_options = array(
'html'=>'<p>This is a piece of nice html code. You can use any tag, but be aware that email readers do not render everything.<p>',
'block_padding_left' => 15,
'block_padding_right' => 15,
'block_background' => '#ffffff',
'font_family' => 'Helvetica, Arial, sans-serif',
'font_size' => 16
);
$options = array_merge($default_options, $options);
?>
<style>
.html-td {
font-family: <?php echo $options['font_family']?>;
font-size: <?php echo $options['font_size']?>px;
color: <?php echo $options['font_color']?>;
}
</style>
<table width="100%" border="0" cellpadding="0" align="center" cellspacing="0">
<tr>
<td width="100%" valign="top" align="center" class="html-td">
<?php echo $options['html'] ?>
</td>
</tr>
</table>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1,42 @@
<?php
/*
* @var $options array contains all the options the current block we're ediging contains
* @var $controls NewsletterControls
*/
$default_options = array(
'block_background'=>'#ffffff',
);
$options = array_merge($default_options, $options);
?>
<style>
.CodeMirror {
height: 400px;
}
</style>
<script>
var templateEditor;
jQuery(function () {
templateEditor = CodeMirror.fromTextArea(document.getElementById("options-html"), {
lineNumbers: true,
mode: 'htmlmixed',
lineWrapping: true,
extraKeys: {"Ctrl-Space": "autocomplete"}
});
});
</script>
<table class="form-table">
<tr>
<td>
<?php $controls->textarea('html') ?>
</td>
</tr>
</table>
<?php $fields->block_commons() ?>

View File

@@ -0,0 +1,4 @@
.html-td p {
font-family: Helvetica, Arial, sans-serif;
font-size: 16px;
}

View File

@@ -0,0 +1,43 @@
<?php
/*
* Name: Single image
* Section: content
* Description: A single image with link
*/
/* @var $options array */
/* @var $wpdb wpdb */
$defaults = array(
'image' => '',
'url' => '',
'block_background' => '#ffffff',
'block_padding_left' => 0,
'block_padding_right' => 0,
'block_padding_bottom' => 15,
'block_padding_top' => 15
);
$options = array_merge($defaults, $options);
$alt = '';
if (empty($options['image']['id'])) {
// A placeholder can be set by a preset and it is kept indefinitely
if (!empty($options['placeholder'])) {
$image = $options['placeholder'];
} else {
$image = 'https://source.unsplash.com/600x250/daily';
}
} else {
$image = tnp_media_resize($options['image']['id'], array(600, 0));
$alt = $options['image_alt'];
}
$url = $options['url'];
?>
<?php if (!empty($url)) { ?>
<a href="<?php echo $url ?>" target="_blank"><img src="<?php echo $image ?>" border="0" alt="" style="max-width: 100%!important; height: auto!important; display: inline-block;"></a>
<?php } else { ?>
<img src="<?php echo $image ?>" border="0" alt="<?php echo esc_attr($alt) ?>" style="max-width: 100%!important; height: auto!important; display: inline-block;">
<?php } ?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -0,0 +1,14 @@
<?php
/* @var $options array contains all the options the current block we're ediging contains */
/* @var $controls NewsletterControls */
/* @var $fields NewsletterFields */
?>
<?php $controls->hidden('placeholder') ?>
<?php $fields->media('image', null, array('alt'=>true)) ?>
<?php $fields->url('url', 'URL') ?>
<?php $fields->block_commons() ?>

View File

@@ -0,0 +1,369 @@
<?php
/*
* Name: Last posts
* Section: content
* Description: Last posts list with different layouts
* Type: dynamic
*/
/* @var $options array */
/* @var $wpdb wpdb */
$defaults = array(
'title' => 'Last news',
'color' => '#999999',
'font_family' => 'Helvetica, Arial, sans-serif',
'font_size' => '16',
'font_color' => '#333333',
'title_font_family' => 'Helvetica, Arial, sans-serif',
'title_font_size' => '25',
'title_font_color' => ' #333333',
'max' => 4,
'button_label' => __('Read more...', 'newsletter'),
'categories' => '',
'tags' => '',
'block_background' => '#ffffff',
'layout' => 'one',
'language' => '',
'button_background' => '#256F9C',
'button_font_color' => '#ffffff',
'button_font_family' => 'Helvetica, Arial, sans-serif',
'button_font_size' => 16,
'block_padding_left' => 15,
'block_padding_right' => 15,
'block_padding_top' => 15,
'block_padding_bottom' => 15
);
$options = array_merge($defaults, $options);
$font_family = $options['font_family'];
$font_size = $options['font_size'];
$title_font_family = $options['title_font_family'];
$title_font_size = $options['title_font_size'];
$show_image = !empty($options['show_image']);
$filters = array();
$filters['posts_per_page'] = (int) $options['max'];
if (!empty($options['categories'])) {
$filters['category__in'] = $options['categories'];
}
if (!empty($options['tags'])) {
$filters['tag'] = $options['tags'];
}
// Filter by time?
//$options['block_last_run'] = time();
if (!empty($context['last_run'])) {
$filters['date_query'] = array(
'after' => gmdate('c', $context['last_run'])
);
}
$posts = Newsletter::instance()->get_posts($filters, $options['language']);
if ($context['type'] == 'automated') {
// No new posts
if (empty($posts)) {
if (isset($options['automated_required'])) {
$out['return_empty_message'] = true;
}
return;
}
if ($options['automated_include'] == 'max') {
unset($filters['date_query']);
$posts = Newsletter::instance()->get_posts($filters, $options['language']);
}
}
$out['subject'] = $posts[0]->post_title;
$button_background = $options['button_background'];
$button_label = $options['button_label'];
$button_font_family = $options['button_font_family'];
$button_font_size = $options['button_font_size'];
$button_color = $options['button_font_color'];
$alternative = plugins_url('newsletter') . '/emails/blocks/posts/images/blank.png';
$alternative_2 = plugins_url('newsletter') . '/emails/blocks/posts/images/blank-240x160.png';
remove_all_filters('excerpt_more');
?>
<?php if ($options['layout'] == 'one') { ?>
<style>
.posts-post-date {
padding: 0 0 5px 25px;
font-size: 13px;
font-family: <?php echo $font_family ?>;
font-weight: normal;
color: #aaaaaa;
}
.posts-post-title {
padding: 0 0 5px 25px;
font-size: <?php echo $title_font_size ?>px;
font-family: <?php echo $title_font_family ?>;
font-weight: normal;
color: <?php echo $options['title_font_color'] ?>;
line-height: normal;
}
.posts-post-excerpt {
padding: 10px 0 15px 25px;
font-family: <?php echo $font_family ?>;
color: <?php echo $options['font_color'] ?>;
font-size: <?php echo $font_size ?>px;
line-height: 1.5em;
}
.posts-button-table {
background-color: <?php echo $button_background ?>;
/*border:1px solid #353535;*/
border-radius:5px;
align: right;
}
.posts-button-td {
color: <?php echo $button_color ?>;
font-family:<?php echo $font_family ?>;
font-size:<?php echo $button_font_size ?>px;
font-weight:normal;
letter-spacing:normal;
line-height:normal;
padding-top:15px;
padding-right:30px;
padding-bottom:15px;
padding-left:30px;
text-align: right;
}
.posts-button-a {
color:<?php echo $button_color ?>;
font-size:<?php echo $button_font_size ?>px;
font-weight:normal;
text-decoration:none;
}
</style>
<!-- COMPACT ARTICLE SECTION -->
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="responsive-table">
<?php foreach ($posts as $post) { ?>
<?php
$url = tnp_post_permalink($post);
?>
<tr>
<?php if ($show_image) { ?>
<td valign="top" style="padding: 30px 0 0 0; width: 105px!important" class="mobile-hide">
<a href="<?php echo tnp_post_permalink($post) ?>" target="_blank">
<img src="<?php echo tnp_post_thumbnail_src($post, array(105, 105, true), $alternative) ?>" width="105" height="105" alt="Image" border="0" style="display: block; font-family: Arial; color: #666666; font-size: 14px; min-width: 105px!important; width: 105px!important;">
</a>
</td>
<?php } ?>
<td style="padding: 30px 0 0 0;" class="no-padding">
<!-- ARTICLE -->
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<?php if (!empty($options['show_date'])) { ?>
<tr>
<td align="left" inline-class="posts-post-date" class="padding-meta">
<?php echo tnp_post_date($post) ?>
</td>
</tr>
<?php } ?>
<tr>
<td align="left" inline-class="posts-post-title" class="padding-copy tnpc-row-edit" data-type="title">
<?php echo tnp_post_title($post) ?>
</td>
</tr>
<tr>
<td align="left" inline-class="posts-post-excerpt" class="padding-copy tnpc-row-edit" data-type="text">
<?php echo tnp_post_excerpt($post) ?>
</td>
</tr>
<tr>
<td align="left" class="padding">
<table border="0" cellpadding="0" cellspacing="0" inline-class="posts-button-table" align="right">
<tr>
<td align="center" valign="middle" inline-class="posts-button-td">
<a href="<?php echo esc_attr($url) ?>" target="_blank" inline-class="posts-button-a"><?php echo $button_label ?></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<?php } ?>
</table>
<?php } else { ?>
<style>
.posts-post-date {
padding: 10px 0 0 15px;
font-size: 13px;
font-family: <?php echo $font_family ?>;
font-weight: normal;
color: #aaaaaa;
}
.posts-post-title {
padding: 15px 0 0 0;
font-family: <?php echo $title_font_family ?>;
color: <?php echo $options['title_font_color'] ?>;
font-size: <?php echo $title_font_size ?>px;
line-height: 1.3em;
}
.posts-post-excerpt {
padding: 5px 0 0 0;
font-family: <?php echo $font_family ?>;
color: <?php echo $options['font_color'] ?>;
font-size: <?php echo $font_size ?>px;
line-height: 1.4em;
}
.posts-button-table {
background-color: <?php echo $button_background ?>;
/*border:1px solid #353535;*/
border-radius:5px;
align: right;
}
.posts-button-td {
color: <?php echo $button_color ?>;
font-family:<?php echo $font_family ?>;
font-size:<?php echo $button_font_size ?>px;
font-weight:normal;
letter-spacing:normal;
line-height:normal;
padding-top:15px;
padding-right:30px;
padding-bottom:15px;
padding-left:30px;
text-align: right;
}
.posts-button-a {
color:<?php echo $button_color ?>;
font-size:<?php echo $button_font_size ?>px;
font-weight:normal;
text-decoration:none;
}
</style>
<!-- TWO COLUMN SECTION -->
<!-- TWO COLUMNS -->
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<?php foreach (array_chunk($posts, 2) AS $row) { ?>
<tr>
<td valign="top" style="padding: 10px;" class="mobile-wrapper">
<!-- LEFT COLUMN -->
<table cellpadding="0" cellspacing="0" border="0" width="47%" align="left" class="responsive-table">
<tr>
<td style="padding: 20px 0 40px 0;">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<?php if ($show_image) { ?>
<tr>
<td align="center" valign="middle" class="tnpc-row-edit" data-type="image">
<a href="<?php echo tnp_post_permalink($row[0]) ?>" target="_blank">
<img src="<?php echo tnp_post_thumbnail_src($row[0], array(240, 160, true), $alternative_2) ?>" alt="Image" width="240" height="160" border="0" class="img-max">
</a>
</td>
</tr>
<?php } ?>
<tr>
<td align="center" inline-class="posts-post-title" class="tnpc-row-edit" data-type="title"><?php echo tnp_post_title($row[0]) ?></td>
</tr>
<?php if (!empty($options['show_date'])) { ?>
<tr>
<td align="center" inline-class="posts-post-date">
<?php echo tnp_post_date($row[0]) ?>
</td>
</tr>
<?php } ?>
<tr>
<td align="center" inline-class="posts-post-excerpt" class="tnpc-row-edit" data-type="text"><?php echo tnp_post_excerpt($row[0]) ?></td>
</tr>
<tr>
<td align="center">
<br>
<table border="0" cellpadding="0" cellspacing="0" inline-class="posts-button-table" align="center">
<tr>
<td align="center" valign="middle" inline-class="posts-button-td">
<a href="<?php echo tnp_post_permalink($row[0]) ?>" target="_blank" inline-class="posts-button-a"><?php echo $button_label ?></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php if (!empty($row[1])) { ?>
<!-- RIGHT COLUMN -->
<table cellpadding="0" cellspacing="0" border="0" width="47%" align="right" class="responsive-table">
<tr>
<td style="padding: 20px 0 40px 0;">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<?php if ($show_image) { ?>
<tr>
<td align="center" valign="middle" class="tnpc-row-edit" data-type="image">
<a href="<?php echo tnp_post_permalink($row[1]) ?>" target="_blank">
<img src="<?php echo tnp_post_thumbnail_src($row[1], array(240, 160, true), $alternative_2) ?>" alt="Image" width="240" height="160" border="0" class="img-max">
</a>
</td>
</tr>
<?php } ?>
<tr>
<td align="center" inline-class="posts-post-title" class="tnpc-row-edit" data-type="title"><?php echo tnp_post_title($row[1]) ?></td>
</tr>
<?php if (!empty($options['show_date'])) { ?>
<tr>
<td align="center" inline-class="posts-post-date">
<?php echo tnp_post_date($row[1]) ?>
</td>
</tr>
<?php } ?>
<tr>
<td align="center" inline-class="posts-post-excerpt" class="tnpc-row-edit" data-type="text"><?php echo tnp_post_excerpt($row[1]) ?></td>
</tr>
<tr>
<td align="center">
<br>
<table border="0" cellpadding="0" cellspacing="0" inline-class="posts-button-table" align="center">
<tr>
<td align="center" valign="middle" inline-class="posts-button-td">
<a href="<?php echo tnp_post_permalink($row[1]) ?>" target="_blank" inline-class="posts-button-a"><?php echo $button_label ?></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php } ?>
</td>
</tr>
<?php } ?>
</table>
<?php } ?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

View File

@@ -0,0 +1,38 @@
<?php
/* @var $options array contains all the options the current block we're ediging contains */
/* @var $controls NewsletterControls */
/* @var $fields NewsletterFields */
?>
<?php if ($context['type'] == 'automated') { ?>
<p>This is a dynamic block which is regenerated with the latest posts when Automated generate a new newsletter.</p>
<?php $fields->select('automated_include', __('What to include', 'newsletter'), array('new' => __('New posts after last newsletter', 'newsletter'),
'max' => __('Always max posts if at least one is new', 'newsletter')),
array('description'=>'This option is effective only when the newsletter is generated, not while composing')) ?>
<?php $fields->checkbox('automated_required', __('Required', 'newsletter'), array('description'=>'This block must return content or the newslettter has not to be sent')) ?>
<?php } ?>
<?php $fields->select('layout', __('Layout', 'newsletter'), array('one' => __('One column', 'newsletter'), 'two' => __('Two columns', 'newsletter'))) ?>
<?php $fields->font('title_font', __('Title font', 'newsletter')) ?>
<?php $fields->font('font', __('Excerpt font', 'newsletter')) ?>
<?php $fields->checkbox('show_image', __('Show image', 'newsletter')) ?>
<?php $fields->checkbox('show_date', __('Show date', 'newsletter')) ?>
<?php $fields->select_number('max', __('Max posts', 'newsletter'), 1, 40); ?>
<?php $fields->language(); ?>
<?php $fields->button('button', 'Button', array('url' => false)) ?>
<?php $fields->section(__('Filters', 'newsletter')) ?>
<?php $fields->categories(); ?>
<?php $fields->text('tags', __('Tags', 'newsletter')); ?>
<?php $fields->block_commons() ?>

View File

@@ -0,0 +1,60 @@
<?php
/*
* Name: Preheader
* Section: header
* Description: Preheader
*
*/
/* @var $options array */
/* @var $wpdb wpdb */
$default_options = array(
'view' => 'View online',
'text' => 'Few words summary',
'block_background' => '#ffffff',
'font_family' => $font_family,
'font_size' => 13,
'font_color' => '#999999',
'font_weight' => 'normal',
'block_padding_left'=>15,
'block_padding_right'=>15,
'block_padding_bottom'=>15,
'block_padding_top'=>15
);
$options = array_merge($default_options, $options);
?>
<style>
.preheader-table {
width: 100%!important
border: 0;
border-collapse: collapse;
}
.preheader-link {
padding: 10px;
font-size: <?php echo $options['font_size'] ?>px;
font-family: <?php echo $options['font_family'] ?>;
font-weight: <?php echo $options['font_weight'] ?>;
color: <?php echo $options['font_color'] ?>;
}
.preheader-view-link {
font-size: <?php echo $options['font_size'] ?>px;
font-family: <?php echo $options['font_family'] ?>;
font-weight: <?php echo $options['font_weight'] ?>;
color: <?php echo $options['font_color'] ?>;
text-decoration: none;
}
</style>
<table width="100%" border="0" cellpadding="0" align="center" cellspacing="0" inline-class="preheader-table">
<tr>
<td class="preheader-link" width="50%" valign="top" align="left">
<?php echo $options['text'] ?>
</td>
<td class="preheader-link" width="50%" valign="top" align="right">
<a href="{email_url}" target="_blank" rel="noopener" class="preheader-view-link"><?php echo $options['view'] ?></a>
</td>
</tr>
</table>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,10 @@
<?php
/* @var $fields NewsletterFields */
?>
<?php $fields->text('text', __('Text', 'newsletter')) ?>
<?php $fields->text('view', __('View online', 'newsletter')) ?>
<?php $fields->font('font') ?>
<?php $fields->block_commons() ?>

View File

@@ -0,0 +1,31 @@
<?php
/*
* Name: Separator
* Section: content
* Description: Separator
*
*/
/* @var $options array */
$default_options = array(
'color'=>'#dddddd',
'height'=>1,
'block_padding_top'=>20,
'block_padding_bottom'=>20,
'block_padding_right'=>20,
'block_padding_left'=>20,
'block_background'=>'#ffffff'
);
$options = array_merge($default_options, $options);
?>
<table border="0" cellpadding="0" align="center" cellspacing="0" width="100%">
<tr>
<td style="border-bottom: <?php echo $options['height'] ?>px solid <?php echo $options['color'] ?>;"></td>
</tr>
</table>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -0,0 +1,8 @@
<?php
/* @var $fields NewsletterFields */
?>
<?php $fields->color('color', __('Color', 'newsletter')) ?>
<?php $fields->select('height', __('Height', 'newsletter'), array('1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5)) ?>
<?php $fields->block_commons() ?>

View File

@@ -0,0 +1,117 @@
<?php
/*
* Name: Social links
* Section: footer
* Description: Link with icons to social profiles
*
*/
/* @var $options array */
/* @var $wpdb wpdb */
$default_options = array(
'block_padding_left' => 15,
'block_padding_right' => 15,
'block_padding_bottom' => 15,
'block_padding_top' => 15,
'block_background'=> '#ffffff'
);
$options = array_merge($default_options, $options);
$social_icon_url = plugins_url('newsletter') . '/emails/themes/default/images';
$configured = false;
?>
<table border="0" cellspacing="0" cellpadding="0" align="center" class="responsive-table">
<tr>
<td align="center">
<?php
if (!empty($block_options['facebook_url'])) {
$configured = true;
?>
<span class="tnpc-row-edit" data-type="image">
<a href="<?php echo $block_options['facebook_url'] ?>"><img src="<?php echo $social_icon_url ?>/facebook.png" alt="Facebook"></a>
</span>
<?php } ?>
<?php
if (!empty($block_options['twitter_url'])) {
$configured = true;
?>
<span class="tnpc-row-edit" data-type="image">
<a href="<?php echo $block_options['twitter_url'] ?>"><img src="<?php echo $social_icon_url ?>/twitter.png" alt="Twitter"></a>
</span>
<?php } ?>
<?php
if (!empty($block_options['googleplus_url'])) {
$configured = true;
?>
<span class="tnpc-row-edit" data-type="image">
<a href="<?php echo $block_options['googleplus_url'] ?>"><img src="<?php echo $social_icon_url ?>/googleplus.png" alt="Google+"></a>
</span>
<?php } ?>
<?php
if (!empty($block_options['pinterest_url'])) {
$configured = true;
?>
<span class="tnpc-row-edit" data-type="image">
<a href="<?php echo $block_options['pinterest_url'] ?>"><img src="<?php echo $social_icon_url ?>/pinterest.png" alt="Pinterest"></a>
</span>
<?php } ?>
<?php
if (!empty($block_options['linkedin_url'])) {
$configured = true;
?>
<span class="tnpc-row-edit" data-type="image">
<a href="<?php echo $block_options['linkedin_url'] ?>"><img src="<?php echo $social_icon_url ?>/linkedin.png" alt="LinkedIn"></a>
</span>
<?php } ?>
<?php
if (!empty($block_options['tumblr_url'])) {
$configured = true;
?>
<span class="tnpc-row-edit" data-type="image">
<a href="<?php echo $block_options['tumblr_url'] ?>"><img src="<?php echo $social_icon_url ?>/tumblr.png" alt="Tumblr"></a>
</span>
<?php } ?>
<?php
if (!empty($block_options['youtube_url'])) {
$configured = true;
?>
<span class="tnpc-row-edit" data-type="image">
<a href="<?php echo $block_options['youtube_url'] ?>"><img src="<?php echo $social_icon_url ?>/youtube.png" alt="Youtube"></a>
</span>
<?php } ?>
<?php
if (!empty($block_options['soundcloud_url'])) {
$configured = true;
?>
<span class="tnpc-row-edit" data-type="image">
<a href="<?php echo $block_options['soundcloud_url'] ?>"><img src="<?php echo $social_icon_url ?>/soundcloud.png" alt="SoundCloud"></a>
</span>
<?php } ?>
<?php
if (!empty($block_options['instagram_url'])) {
$configured = true;
?>
<span class="tnpc-row-edit" data-type="image">
<a href="<?php echo $block_options['instagram_url'] ?>"><img src="<?php echo $social_icon_url ?>/instagram.png" alt="Instagram"></a>
</span>
<?php } ?>
<?php
if (!empty($block_options['vimeo_url'])) {
$configured = true;
?>
<span class="tnpc-row-edit" data-type="image">
<a href="<?php echo $block_options['vimeo_url'] ?>"><img src="<?php echo $social_icon_url ?>/vimeo.png" alt="Vimeo"></a>
</span>
<?php } ?>
<?php if (!$configured) { ?>
<p>Configure your social links in the <a href="?page=newsletter_main_info">Social configuration section</a>.<br/>
Then remove and add again this block.</p>
<?php } ?>
</td>
</tr>
</table>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -0,0 +1,9 @@
<?php
/* @var $options array contains all the options the current block we're ediging contains */
/* @var $controls NewsletterControls */
/* @var $fields NewsletterFields */
?>
<p>Social profiles can be configured on company info panel.</p>
<?php $fields->block_commons() ?>

View File

@@ -0,0 +1,47 @@
<?php
/*
* Name: Text
* Section: content
* Description: Free text block
*
*/
/* @var $options array */
$default_options = array(
'html'=>'<p style="text-align: left; font-size: 16px; font-family: Arial">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam vitae sodales nulla, nec blandit velit. Morbi feugiat imperdiet augue, vel mattis augue sagittis rutrum. Sed.</p>',
'font_family'=>'Helvetica, Arial, sans-serif',
'font_size'=>16,
'font_color'=>'#000000',
'block_padding_left'=>15,
'block_padding_right'=>15,
'block_background'=>'#ffffff'
);
$options = array_merge($default_options, $options);
/*
$options['html'] = str_replace('<p>', '<p style="">', $options['html']);
$style = 'font-family: ' . $options['font_family'] . ';font-size: ' . $options['font_size'] . 'px; color: <?php echo $options['font_color']?>;
$options['html'] = str_replace('<p', '<p inline-class="text-p"', $options['html']);
*/
?>
<style>
.text-td {
font-family: <?php echo $options['font_family']?>;
font-size: <?php echo $options['font_size']?>px;
color: <?php echo $options['font_color']?>;
line-height: 1.5rem;
}
.text-p {
font-family: <?php echo $options['font_family']?>;
font-size: <?php echo $options['font_size']?>px;
}
</style>
<table width="100%" style="width: 100%!important" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" valign="top" align="left" class="text-td">
<?php echo $options['html'] ?>
</td>
</tr>
</table>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,11 @@
<?php
/*
* @var $options array contains all the options the current block we're ediging contains
* @var $controls NewsletterControls
*/
/* @var $fields NewsletterFields */
?>
<?php //$fields->font() ?>
<?php $fields->wp_editor('html', 'Content') ?>
<?php $fields->block_commons() ?>