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
|
||||
position: relative
|
||||
margin: 20px 0 0 0
|
||||
|
||||
/* MailPoet Form container */
|
||||
#mailpoet_form_container
|
||||
|
@@ -42,11 +42,7 @@ define(
|
||||
return (
|
||||
<div>
|
||||
<h2 className="title">
|
||||
Segment <a
|
||||
href="javascript:;"
|
||||
className="add-new-h2"
|
||||
onClick={ this.history.goBack }
|
||||
>Back to list</a>
|
||||
Segment
|
||||
</h2>
|
||||
|
||||
<Form
|
||||
|
@@ -70,11 +70,7 @@ define(
|
||||
return (
|
||||
<div>
|
||||
<h2 className="title">
|
||||
Subscriber <a
|
||||
href="javascript:;"
|
||||
className="add-new-h2"
|
||||
onClick={ this.history.goBack }
|
||||
>Back to list</a>
|
||||
Subscriber
|
||||
</h2>
|
||||
|
||||
<Form
|
||||
|
@@ -28,6 +28,7 @@ class Initializer {
|
||||
$this->setupChangelog();
|
||||
$this->setupPublicAPI();
|
||||
$this->runQueueSupervisor();
|
||||
$this->setupShortcodes();
|
||||
$this->setupHooks();
|
||||
$this->setupImages();
|
||||
}
|
||||
@@ -125,6 +126,10 @@ class Initializer {
|
||||
$changelog->init();
|
||||
}
|
||||
|
||||
function setupShortcodes() {
|
||||
$shortcodes = new Shortcodes();
|
||||
$shortcodes->init();
|
||||
}
|
||||
function setupHooks() {
|
||||
$hooks = new Hooks();
|
||||
$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(
|
||||
'mailpoet_form',
|
||||
__("MailPoet Subscription Form"),
|
||||
__('MailPoet Form'),
|
||||
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
|
||||
if(isset($_GET['mailpoet_page']) && strlen(trim($_GET['mailpoet_page'])) > 0) {
|
||||
switch($_GET['mailpoet_page']) {
|
||||
|
@@ -70,7 +70,7 @@ class MailPoet {
|
||||
'Content-Type' => 'application/json',
|
||||
'Authorization' => $this->auth()
|
||||
),
|
||||
'body' => json_encode($body)
|
||||
'body' => $body
|
||||
);
|
||||
}
|
||||
}
|
@@ -9,10 +9,6 @@
|
||||
class="add-new-h2"
|
||||
href="javascript:;"
|
||||
><%= __('Edit name' ) %></a>
|
||||
<a
|
||||
href="<%= admin_url('admin.php?page=mailpoet-forms') | raw %>"
|
||||
class="add-new-h2"
|
||||
><%= __('List of forms' ) %></a>
|
||||
</h2>
|
||||
<% endblock %>
|
||||
|
||||
@@ -122,12 +118,12 @@
|
||||
<!-- Toolbar: Shortcodes / Export -->
|
||||
<div class="mailpoet_toolbar_section closed" data-section="shortcodes">
|
||||
<a href="javascript:;" class="mailpoet_toggle"><br /></a>
|
||||
<h3><%= __('Shortcodes') %></h3>
|
||||
<h3><%= __('Position') %></h3>
|
||||
|
||||
<div>
|
||||
<!-- Form export links -->
|
||||
<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({
|
||||
'[link]': '<a href="widgets.php" target="_blank">',
|
||||
'[/link]': '</a>'
|
||||
@@ -136,15 +132,22 @@
|
||||
%>
|
||||
</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(
|
||||
'<a href="javascript:;" class="mailpoet_form_export_toggle" data-type="html">',
|
||||
'</a>',
|
||||
'<a href="javascript:;" class="mailpoet_form_export_toggle" data-type="php">',
|
||||
'</a>',
|
||||
'<a href="javascript:;" class="mailpoet_form_export_toggle" data-type="iframe">',
|
||||
'</a>',
|
||||
'<a href="javascript:;" class="mailpoet_form_export_toggle" data-type="shortcode">',
|
||||
'</a>'
|
||||
)
|
||||
| raw
|
||||
@@ -519,7 +522,7 @@
|
||||
var name = $(this).siblings('.mailpoet_form_field').attr('wysija_name');
|
||||
|
||||
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({
|
||||
endpoint: 'customFields',
|
||||
|
@@ -1,9 +1,7 @@
|
||||
{{#if params.text}}
|
||||
<p>
|
||||
{{#if params.nl2br}}
|
||||
{{#ifCond params.nl2br '==' '1'}}
|
||||
{{{ nl2br params.text }}}
|
||||
{{else}}
|
||||
{{{ params.text }}}
|
||||
{{/if}}
|
||||
</p>
|
||||
{{/ifCond}}
|
||||
{{/if}}
|
@@ -1 +1 @@
|
||||
<input type="submit" value="{{ params.label }}" />
|
||||
<input type="submit" value="{{ params.label }}" class="button" />
|
Reference in New Issue
Block a user