first round of fixes #255
This commit is contained in:
@@ -99,6 +99,7 @@ handle_icon = '../img/handle.png'
|
|||||||
/* MailPoet Form wrapper */
|
/* MailPoet Form wrapper */
|
||||||
#mailpoet_form_wrapper
|
#mailpoet_form_wrapper
|
||||||
position: relative
|
position: relative
|
||||||
|
margin: 20px 0 0 0
|
||||||
|
|
||||||
/* MailPoet Form container */
|
/* MailPoet Form container */
|
||||||
#mailpoet_form_container
|
#mailpoet_form_container
|
||||||
|
@@ -42,11 +42,7 @@ define(
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h2 className="title">
|
<h2 className="title">
|
||||||
Segment <a
|
Segment
|
||||||
href="javascript:;"
|
|
||||||
className="add-new-h2"
|
|
||||||
onClick={ this.history.goBack }
|
|
||||||
>Back to list</a>
|
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<Form
|
<Form
|
||||||
|
@@ -70,11 +70,7 @@ define(
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h2 className="title">
|
<h2 className="title">
|
||||||
Subscriber <a
|
Subscriber
|
||||||
href="javascript:;"
|
|
||||||
className="add-new-h2"
|
|
||||||
onClick={ this.history.goBack }
|
|
||||||
>Back to list</a>
|
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<Form
|
<Form
|
||||||
|
@@ -28,6 +28,7 @@ class Initializer {
|
|||||||
$this->setupChangelog();
|
$this->setupChangelog();
|
||||||
$this->setupPublicAPI();
|
$this->setupPublicAPI();
|
||||||
$this->runQueueSupervisor();
|
$this->runQueueSupervisor();
|
||||||
|
$this->setupShortcodes();
|
||||||
$this->setupHooks();
|
$this->setupHooks();
|
||||||
$this->setupImages();
|
$this->setupImages();
|
||||||
}
|
}
|
||||||
@@ -125,6 +126,10 @@ class Initializer {
|
|||||||
$changelog->init();
|
$changelog->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setupShortcodes() {
|
||||||
|
$shortcodes = new Shortcodes();
|
||||||
|
$shortcodes->init();
|
||||||
|
}
|
||||||
function setupHooks() {
|
function setupHooks() {
|
||||||
$hooks = new Hooks();
|
$hooks = new Hooks();
|
||||||
$hooks->init();
|
$hooks->init();
|
||||||
|
26
lib/Config/Shortcodes.php
Normal file
26
lib/Config/Shortcodes.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
namespace MailPoet\Config;
|
||||||
|
|
||||||
|
class Shortcodes {
|
||||||
|
function __construct() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
// form widget shortcode
|
||||||
|
add_shortcode('mailpoet_form', array($this, 'formWidget'));
|
||||||
|
add_shortcode('wysija_form', array($this, 'formWidget'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function formWidget($params = array()) {
|
||||||
|
// IMPORTANT: fixes conflict with MagicMember
|
||||||
|
remove_shortcode('user_list');
|
||||||
|
|
||||||
|
if(isset($params['id']) && (int)$params['id'] > 0) {
|
||||||
|
$form_widget = new \MailPoet\Form\Widget();
|
||||||
|
return $form_widget->widget(array(
|
||||||
|
'form' => (int)$params['id'],
|
||||||
|
'form_type' => 'shortcode'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -36,9 +36,9 @@ class Widget extends \WP_Widget {
|
|||||||
|
|
||||||
return parent::__construct(
|
return parent::__construct(
|
||||||
'mailpoet_form',
|
'mailpoet_form',
|
||||||
__("MailPoet Subscription Form"),
|
__('MailPoet Form'),
|
||||||
array(
|
array(
|
||||||
'title' => __("Newsletter subscription form"),
|
'description' => __('Add a newsletter subscription form.')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -196,24 +196,6 @@ class Widget extends \WP_Widget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// mailpoet shortcodes
|
|
||||||
// form shortcode
|
|
||||||
add_shortcode('mailpoet_form', 'mailpoet_form_shortcode');
|
|
||||||
add_shortcode('wysija_form', 'mailpoet_form_shortcode');
|
|
||||||
|
|
||||||
function mailpoet_form_shortcode($params = array()) {
|
|
||||||
// IMPORTANT: this is to make sure MagicMember won't scan our form and find [user_list] as a code they should replace.
|
|
||||||
remove_shortcode('user_list');
|
|
||||||
|
|
||||||
if(isset($params['id']) && (int)$params['id'] > 0) {
|
|
||||||
$form_widget = new \MailPoet\Form\Widget();
|
|
||||||
return $form_widget->widget(array(
|
|
||||||
'form' => (int)$params['id'],
|
|
||||||
'form_type' => 'shortcode'
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the content filter to replace the shortcode
|
// set the content filter to replace the shortcode
|
||||||
if(isset($_GET['mailpoet_page']) && strlen(trim($_GET['mailpoet_page'])) > 0) {
|
if(isset($_GET['mailpoet_page']) && strlen(trim($_GET['mailpoet_page'])) > 0) {
|
||||||
switch($_GET['mailpoet_page']) {
|
switch($_GET['mailpoet_page']) {
|
||||||
|
@@ -70,7 +70,7 @@ class MailPoet {
|
|||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'Authorization' => $this->auth()
|
'Authorization' => $this->auth()
|
||||||
),
|
),
|
||||||
'body' => json_encode($body)
|
'body' => $body
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -9,10 +9,6 @@
|
|||||||
class="add-new-h2"
|
class="add-new-h2"
|
||||||
href="javascript:;"
|
href="javascript:;"
|
||||||
><%= __('Edit name' ) %></a>
|
><%= __('Edit name' ) %></a>
|
||||||
<a
|
|
||||||
href="<%= admin_url('admin.php?page=mailpoet-forms') | raw %>"
|
|
||||||
class="add-new-h2"
|
|
||||||
><%= __('List of forms' ) %></a>
|
|
||||||
</h2>
|
</h2>
|
||||||
<% endblock %>
|
<% endblock %>
|
||||||
|
|
||||||
@@ -122,12 +118,12 @@
|
|||||||
<!-- Toolbar: Shortcodes / Export -->
|
<!-- Toolbar: Shortcodes / Export -->
|
||||||
<div class="mailpoet_toolbar_section closed" data-section="shortcodes">
|
<div class="mailpoet_toolbar_section closed" data-section="shortcodes">
|
||||||
<a href="javascript:;" class="mailpoet_toggle"><br /></a>
|
<a href="javascript:;" class="mailpoet_toggle"><br /></a>
|
||||||
<h3><%= __('Shortcodes') %></h3>
|
<h3><%= __('Position') %></h3>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<!-- Form export links -->
|
<!-- Form export links -->
|
||||||
<p>
|
<p>
|
||||||
<%= __("You can easily add this form to your theme's in the [link]Widgets area[/link]")
|
<%= __("Add this form to your sidebar or footer in the [link]Widgets[/link].")
|
||||||
| replace({
|
| replace({
|
||||||
'[link]': '<a href="widgets.php" target="_blank">',
|
'[link]': '<a href="widgets.php" target="_blank">',
|
||||||
'[/link]': '</a>'
|
'[/link]': '</a>'
|
||||||
@@ -136,15 +132,22 @@
|
|||||||
%>
|
%>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<%= __('%sHTML%s, %sPHP%s, %siframe%s and %sshortcode%s versions are also available.', 'wysija-newsletters')
|
<%= __("Copy and paste this [link]shortcode[/link] into a post or page alternatively.")
|
||||||
|
| replace({
|
||||||
|
'[link]': '<a href="javascript:;" class="mailpoet_form_export_toggle" data-type="shortcode">',
|
||||||
|
'[/link]': '</a>'
|
||||||
|
})
|
||||||
|
| raw
|
||||||
|
%>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= __('%sHTML%s, %sPHP%s and %siframe%s versions are also available.', 'wysija-newsletters')
|
||||||
| format(
|
| format(
|
||||||
'<a href="javascript:;" class="mailpoet_form_export_toggle" data-type="html">',
|
'<a href="javascript:;" class="mailpoet_form_export_toggle" data-type="html">',
|
||||||
'</a>',
|
'</a>',
|
||||||
'<a href="javascript:;" class="mailpoet_form_export_toggle" data-type="php">',
|
'<a href="javascript:;" class="mailpoet_form_export_toggle" data-type="php">',
|
||||||
'</a>',
|
'</a>',
|
||||||
'<a href="javascript:;" class="mailpoet_form_export_toggle" data-type="iframe">',
|
'<a href="javascript:;" class="mailpoet_form_export_toggle" data-type="iframe">',
|
||||||
'</a>',
|
|
||||||
'<a href="javascript:;" class="mailpoet_form_export_toggle" data-type="shortcode">',
|
|
||||||
'</a>'
|
'</a>'
|
||||||
)
|
)
|
||||||
| raw
|
| raw
|
||||||
@@ -519,7 +522,7 @@
|
|||||||
var name = $(this).siblings('.mailpoet_form_field').attr('wysija_name');
|
var name = $(this).siblings('.mailpoet_form_field').attr('wysija_name');
|
||||||
|
|
||||||
if(window.confirm(
|
if(window.confirm(
|
||||||
"<%= __('Do you really want to delete this custom field?') %>"
|
"<%= __('Deleting this field here will delete the data associated to it for all you users. Confirm you want to delete.') %>"
|
||||||
)) {
|
)) {
|
||||||
MailPoet.Ajax.post({
|
MailPoet.Ajax.post({
|
||||||
endpoint: 'customFields',
|
endpoint: 'customFields',
|
||||||
|
@@ -1,9 +1,7 @@
|
|||||||
{{#if params.text}}
|
{{#if params.text}}
|
||||||
<p>
|
{{#ifCond params.nl2br '==' '1'}}
|
||||||
{{#if params.nl2br}}
|
|
||||||
{{{ nl2br params.text }}}
|
{{{ nl2br params.text }}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{{ params.text }}}
|
{{{ params.text }}}
|
||||||
{{/if}}
|
{{/ifCond}}
|
||||||
</p>
|
|
||||||
{{/if}}
|
{{/if}}
|
@@ -1 +1 @@
|
|||||||
<input type="submit" value="{{ params.label }}" />
|
<input type="submit" value="{{ params.label }}" class="button" />
|
Reference in New Issue
Block a user