Version Description
Download this release
Release Info
Developer | Collizo4sky |
Plugin | Subscribe2 |
Version | 10.26.1 |
Comparing to | |
See all releases |
Code changes from version 10.26 to 10.26.1
- ChangeLog.txt +4 -0
- ReadMe.txt +5 -0
- classes/class-s2-block-editor.php +135 -0
- classes/class-s2-core.php +6 -1
- gutenberg/gutenberg-translations.php +28 -0
- gutenberg/shortcode.js +392 -0
- gutenberg/shortcode.min.js +1 -0
- gutenberg/sidebar.js +139 -0
- gutenberg/sidebar.min.js +1 -0
- subscribe2.php +2 -2
- subscribe2.pot +84 -3
ChangeLog.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
= 10.26 =
|
2 |
|
3 |
* Fixed a bug in barred domain checking
|
1 |
+
= 10.26.1 =
|
2 |
+
|
3 |
+
* Added Gutenberg support.
|
4 |
+
|
5 |
= 10.26 =
|
6 |
|
7 |
* Fixed a bug in barred domain checking
|
ReadMe.txt
CHANGED
@@ -4,6 +4,7 @@ Donate link: https://mailoptin.io
|
|
4 |
Tags: posts, subscription, email, subscribe, notify, notification, newsletter, post notification, email marketing
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.0.3
|
|
|
7 |
License: GPLv3
|
8 |
|
9 |
Sends a list of subscribers an email notification when you publish new posts.
|
@@ -65,6 +66,10 @@ This token will automatically be replaced by dynamic subscription information an
|
|
65 |
|
66 |
== Changelog ==
|
67 |
|
|
|
|
|
|
|
|
|
68 |
= 10.26 =
|
69 |
|
70 |
* Fixed a bug in barred domain checking
|
4 |
Tags: posts, subscription, email, subscribe, notify, notification, newsletter, post notification, email marketing
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.0.3
|
7 |
+
Stable tag: 10.26.1
|
8 |
License: GPLv3
|
9 |
|
10 |
Sends a list of subscribers an email notification when you publish new posts.
|
66 |
|
67 |
== Changelog ==
|
68 |
|
69 |
+
= 10.26.1 =
|
70 |
+
|
71 |
+
* Added Gutenberg support.
|
72 |
+
|
73 |
= 10.26 =
|
74 |
|
75 |
* Fixed a bug in barred domain checking
|
classes/class-s2-block-editor.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class S2_Block_Editor {
|
3 |
+
/**
|
4 |
+
* Constructor
|
5 |
+
*/
|
6 |
+
public function __construct() {
|
7 |
+
// maybe use dev scripts
|
8 |
+
$this->script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
9 |
+
|
10 |
+
add_action( 'init', array( &$this, 'register_s2_meta' ) );
|
11 |
+
add_action( 'rest_api_init', array( $this, 'register_preview_endpoint' ) );
|
12 |
+
|
13 |
+
if ( is_admin() ) {
|
14 |
+
add_action( 'admin_enqueue_scripts', array( &$this, 'gutenberg_block_editor_assets' ), 6 );
|
15 |
+
add_action( 'admin_enqueue_scripts', array( &$this, 'gutenberg_i18n' ), 6 );
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Register _s2mail meta data for Block Editor
|
21 |
+
*/
|
22 |
+
public function register_s2_meta() {
|
23 |
+
register_meta(
|
24 |
+
'post',
|
25 |
+
'_s2mail',
|
26 |
+
array(
|
27 |
+
'show_in_rest' => true,
|
28 |
+
'single' => true,
|
29 |
+
'type' => 'string',
|
30 |
+
'auth_callback' => function() {
|
31 |
+
return current_user_can( 'edit_posts' );
|
32 |
+
},
|
33 |
+
)
|
34 |
+
);
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Register REST endpointsfor preview email
|
39 |
+
*/
|
40 |
+
public function register_preview_endpoint() {
|
41 |
+
register_rest_route(
|
42 |
+
's2/v1',
|
43 |
+
'/preview/(?P<id>[0-9]+)',
|
44 |
+
array(
|
45 |
+
'methods' => WP_REST_Server::READABLE,
|
46 |
+
'callback' => array( $this, 'preview' ),
|
47 |
+
'args' => array(
|
48 |
+
'id' => array(
|
49 |
+
'validate_callback' => function( $param ) {
|
50 |
+
return preg_match( '/\\d/', $param ) > 0;
|
51 |
+
},
|
52 |
+
),
|
53 |
+
),
|
54 |
+
'permission_callback' => function () {
|
55 |
+
return current_user_can( 'edit_posts' );
|
56 |
+
},
|
57 |
+
)
|
58 |
+
);
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Function to trigger Preview email on REST API request
|
63 |
+
*/
|
64 |
+
public function preview( $data ) {
|
65 |
+
global $mysubscribe2;
|
66 |
+
$post = get_post( intval( $data['id'] ) );
|
67 |
+
|
68 |
+
$current_user = wp_get_current_user();
|
69 |
+
if ( 0 === $current_user->ID ) {
|
70 |
+
return false;
|
71 |
+
}
|
72 |
+
$mysubscribe2->publish( $post, $current_user->user_email );
|
73 |
+
return true;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Enqueue Block Editor assets
|
78 |
+
*/
|
79 |
+
public function gutenberg_block_editor_assets() {
|
80 |
+
global $pagenow;
|
81 |
+
if ( ! in_array( $pagenow, array( 'post-new.php', 'post.php', 'page-new.php', 'page.php' ) ) ) {
|
82 |
+
return;
|
83 |
+
}
|
84 |
+
|
85 |
+
wp_enqueue_script(
|
86 |
+
'subscribe2-shortcode',
|
87 |
+
S2URL . 'gutenberg/shortcode' . $this->script_debug . '.js',
|
88 |
+
array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor' ),
|
89 |
+
'1.1'
|
90 |
+
);
|
91 |
+
|
92 |
+
register_block_type(
|
93 |
+
'subscribe2-html/shortcode',
|
94 |
+
array(
|
95 |
+
'editor_script' => 'subscribe2-shortcode',
|
96 |
+
)
|
97 |
+
);
|
98 |
+
|
99 |
+
wp_enqueue_script(
|
100 |
+
'subscribe2-sidebar',
|
101 |
+
S2URL . 'gutenberg/sidebar' . $this->script_debug . '.js',
|
102 |
+
array( 'wp-plugins', 'wp-element', 'wp-i18n', 'wp-edit-post', 'wp-components', 'wp-data', 'wp-compose', 'wp-api-fetch' ),
|
103 |
+
'1.0'
|
104 |
+
);
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Handle translation of Block Editor assets
|
109 |
+
*/
|
110 |
+
public function gutenberg_i18n() {
|
111 |
+
global $pagenow;
|
112 |
+
if ( ! in_array( $pagenow, array( 'post-new.php', 'post.php', 'page-new.php', 'page.php' ) ) ) {
|
113 |
+
return;
|
114 |
+
}
|
115 |
+
|
116 |
+
$translations = get_translations_for_domain( 'subscribe2' );
|
117 |
+
|
118 |
+
$locale_data = array(
|
119 |
+
'' => array(
|
120 |
+
'domain' => 'subscribe2',
|
121 |
+
'lang' => get_user_locale(),
|
122 |
+
'plural_forms' => 'nplurals=2; plural=n != 1;',
|
123 |
+
),
|
124 |
+
);
|
125 |
+
|
126 |
+
foreach ( $translations->entries as $msgid => $entry ) {
|
127 |
+
$locale_data[ $msgid ] = $entry->translations;
|
128 |
+
}
|
129 |
+
|
130 |
+
wp_add_inline_script(
|
131 |
+
'wp-i18n',
|
132 |
+
'wp.i18n.setLocaleData( ' . wp_json_encode( $locale_data ) . ', "subscribe2" );'
|
133 |
+
);
|
134 |
+
}
|
135 |
+
}
|
classes/class-s2-core.php
CHANGED
@@ -1751,7 +1751,6 @@ class S2_Core {
|
|
1751 |
*/
|
1752 |
public function s2init() {
|
1753 |
global $wpdb, $wp_version, $wpmu_version;
|
1754 |
-
|
1755 |
// load the options
|
1756 |
$this->subscribe2_options = get_option( 'subscribe2_options' );
|
1757 |
|
@@ -1887,6 +1886,12 @@ class S2_Core {
|
|
1887 |
$this->block_editor = true;
|
1888 |
}
|
1889 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1890 |
// Add actions specific to admin or frontend
|
1891 |
if ( is_admin() ) {
|
1892 |
//add menu, authoring and category admin actions
|
1751 |
*/
|
1752 |
public function s2init() {
|
1753 |
global $wpdb, $wp_version, $wpmu_version;
|
|
|
1754 |
// load the options
|
1755 |
$this->subscribe2_options = get_option( 'subscribe2_options' );
|
1756 |
|
1886 |
$this->block_editor = true;
|
1887 |
}
|
1888 |
|
1889 |
+
if ( true === $this->block_editor ) {
|
1890 |
+
require_once S2PATH . 'classes/class-s2-block-editor.php';
|
1891 |
+
global $mysubscribe2_block_editor;
|
1892 |
+
$mysubscribe2_block_editor = new S2_Block_Editor();
|
1893 |
+
}
|
1894 |
+
|
1895 |
// Add actions specific to admin or frontend
|
1896 |
if ( is_admin() ) {
|
1897 |
//add menu, authoring and category admin actions
|
gutenberg/gutenberg-translations.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */
|
3 |
+
/* THIS FILE EXPOSES STRINGS FROM JAVASCRIPT FILES FOR TRANSLATION */
|
4 |
+
$generated_i18n_strings = array(
|
5 |
+
__( 'Subscribe2 HTML', 'subscribe2' ),
|
6 |
+
__( 'email', 'subscribe2' ),
|
7 |
+
__( 'notification', 'subscribe2' ),
|
8 |
+
__( 'Subscribe2 Shortcode Parameters', 'subscribe2' ),
|
9 |
+
__( 'Button Display Options', 'subscribe2' ),
|
10 |
+
__( 'Show Both Buttons', 'subscribe2' ),
|
11 |
+
__( 'Hide Subscribe Button', 'subscribe2' ),
|
12 |
+
__( 'Hide Unsubscribe Button', 'subscribe2' ),
|
13 |
+
__( 'Page ID', 'subscribe2' ),
|
14 |
+
__( 'Disable Javascript', 'subscribe2' ),
|
15 |
+
__( 'Disable Simple Anti-Spam Measures', 'subscribe2' ),
|
16 |
+
__( 'Textbox size', 'subscribe2' ),
|
17 |
+
__( 'Disable wrapping of form buttons', 'subscribe2' ),
|
18 |
+
__( 'Link Text', 'subscribe2' ),
|
19 |
+
__( 'Subscribe2 HTML Shortcode', 'subscribe2' ),
|
20 |
+
__( 'Check here to disable sending of an email notification for this post/page', 'subscribe2' ),
|
21 |
+
__( 'Attempt made to send email preview', 'subscribe2' ),
|
22 |
+
__( 'Subscribe2 Sidebar', 'subscribe2' ),
|
23 |
+
__( 'Subscribe2 Sidebar', 'subscribe2' ),
|
24 |
+
__( 'Subscribe2 Override', 'subscribe2' ),
|
25 |
+
__( 'Subscribe2 Preview', 'subscribe2' ),
|
26 |
+
__( 'Send preview email of this post to currently logged in user:', 'subscribe2' ),
|
27 |
+
__( 'Send Preview', 'subscribe2' ),
|
28 |
+
);
|
gutenberg/shortcode.js
ADDED
@@ -0,0 +1,392 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Version 1.0 - Initial version
|
2 |
+
// Version 1.0.1 - fix for useOnce deprecation, improve Transition from unsaved block and update 'edit' drop use of id
|
3 |
+
// Version 1.0.2 - fixed issue with transformation of text box size at default value
|
4 |
+
// Version 1.1 - eslinted and fixed bug in transformation of wrap attribute
|
5 |
+
|
6 |
+
( function( blocks, i18n, element, components, editor ) {
|
7 |
+
var el = element.createElement,
|
8 |
+
TextControl = components.TextControl,
|
9 |
+
CheckboxControl = components.CheckboxControl,
|
10 |
+
RadioControl = components.RadioControl;
|
11 |
+
|
12 |
+
function s2shortcode( props, control, newVal ) {
|
13 |
+
var attributes = props.attributes || '';
|
14 |
+
var hide = '',
|
15 |
+
id = '',
|
16 |
+
nojs = '',
|
17 |
+
antispam = '',
|
18 |
+
size = '',
|
19 |
+
wrap = '',
|
20 |
+
link = '';
|
21 |
+
|
22 |
+
// First we define the shortcode parameters from known Control values
|
23 |
+
if ( 'subscribe' === attributes.hide ) {
|
24 |
+
hide = ' hide="subscribe"';
|
25 |
+
} else if ( 'unsubscribe' === attributes.hide ) {
|
26 |
+
hide = ' hide="unsubscribe"';
|
27 |
+
}
|
28 |
+
if ( '' !== attributes.id && undefined !== attributes.id ) {
|
29 |
+
id = ' id="' + attributes.id + '"';
|
30 |
+
}
|
31 |
+
if ( true === attributes.nojs ) {
|
32 |
+
nojs = ' nojs="true"';
|
33 |
+
}
|
34 |
+
if ( true === attributes.antispam ) {
|
35 |
+
antispam = ' antispam="true"';
|
36 |
+
}
|
37 |
+
if ( '' !== attributes.size && undefined !== attributes.size && '20' !== attributes.size ) {
|
38 |
+
size = ' size="' + attributes.size + '"';
|
39 |
+
}
|
40 |
+
if ( true === attributes.wrap ) {
|
41 |
+
wrap = ' wrap="false"';
|
42 |
+
}
|
43 |
+
if ( '' !== attributes.link && undefined !== attributes.link ) {
|
44 |
+
link = ' link="' + attributes.link + '"';
|
45 |
+
}
|
46 |
+
|
47 |
+
// Second we amend parameter values based on recent input as values are asynchronous
|
48 |
+
switch ( control ) {
|
49 |
+
case 'hide':
|
50 |
+
if ( 'none' === newVal ) {
|
51 |
+
hide = '';
|
52 |
+
} else if ( 'subscribe' === newVal ) {
|
53 |
+
hide = ' hide="subscribe"';
|
54 |
+
} else if ( 'unsubscribe' === newVal ) {
|
55 |
+
hide = ' hide="unsubscribe"';
|
56 |
+
}
|
57 |
+
break;
|
58 |
+
case 'id':
|
59 |
+
if ( '' === newVal ) {
|
60 |
+
id = '';
|
61 |
+
} else {
|
62 |
+
id = ' id="' + newVal + '"';
|
63 |
+
}
|
64 |
+
break;
|
65 |
+
case 'nojs':
|
66 |
+
if ( true === newVal ) {
|
67 |
+
nojs = ' nojs="true"';
|
68 |
+
} else if ( false === newVal ) {
|
69 |
+
nojs = '';
|
70 |
+
}
|
71 |
+
break;
|
72 |
+
case 'antispam':
|
73 |
+
if ( true === newVal ) {
|
74 |
+
antispam = ' antispam="true"';
|
75 |
+
} else if ( false === newVal ) {
|
76 |
+
antispam = '';
|
77 |
+
}
|
78 |
+
break;
|
79 |
+
case 'size':
|
80 |
+
if ( '20' === newVal ) {
|
81 |
+
size = '';
|
82 |
+
} else {
|
83 |
+
size = ' size="' + newVal + '"';
|
84 |
+
}
|
85 |
+
break;
|
86 |
+
case 'wrap':
|
87 |
+
if ( true === newVal ) {
|
88 |
+
wrap = ' wrap="false"';
|
89 |
+
} else if ( false === newVal ) {
|
90 |
+
wrap = '';
|
91 |
+
}
|
92 |
+
break;
|
93 |
+
case 'link':
|
94 |
+
if ( '' === newVal ) {
|
95 |
+
link = '';
|
96 |
+
} else {
|
97 |
+
link = ' link="' + newVal + '"';
|
98 |
+
}
|
99 |
+
break;
|
100 |
+
default:
|
101 |
+
break;
|
102 |
+
}
|
103 |
+
|
104 |
+
// Now we construct and return our shortcode
|
105 |
+
props.attributes.shortcode = '[subscribe2' + hide + id + nojs + antispam + size + wrap + link + ']';
|
106 |
+
return props.attributes.shortcode;
|
107 |
+
}
|
108 |
+
|
109 |
+
blocks.registerBlockType( 'subscribe2-html/shortcode', {
|
110 |
+
title: i18n.__( 'Subscribe2 HTML', 'subscribe2' ),
|
111 |
+
icon: 'email',
|
112 |
+
category: 'widgets',
|
113 |
+
keywords: [
|
114 |
+
i18n.__( 'email', 'subscribe2' ),
|
115 |
+
i18n.__( 'notification', 'subscribe2' )
|
116 |
+
],
|
117 |
+
supports: {
|
118 |
+
customClassName: false,
|
119 |
+
className: false,
|
120 |
+
multiple: false,
|
121 |
+
html: false
|
122 |
+
},
|
123 |
+
attributes: {
|
124 |
+
shortcode: {
|
125 |
+
type: 'text',
|
126 |
+
selector: 'p'
|
127 |
+
},
|
128 |
+
hide: {
|
129 |
+
type: 'string'
|
130 |
+
},
|
131 |
+
id: {
|
132 |
+
type: 'string'
|
133 |
+
},
|
134 |
+
nojs: {
|
135 |
+
type: 'boolean'
|
136 |
+
},
|
137 |
+
antispam: {
|
138 |
+
type: 'boolean'
|
139 |
+
},
|
140 |
+
size: {
|
141 |
+
type: 'number'
|
142 |
+
},
|
143 |
+
wrap: {
|
144 |
+
type: 'boolean'
|
145 |
+
},
|
146 |
+
link: {
|
147 |
+
type: 'string'
|
148 |
+
}
|
149 |
+
},
|
150 |
+
transforms: {
|
151 |
+
to: [
|
152 |
+
{
|
153 |
+
type: 'block',
|
154 |
+
blocks: [ 'core/shortcode' ],
|
155 |
+
transform: function( content ) {
|
156 |
+
if ( undefined === content.shortcode || '' === content.shortcode ) {
|
157 |
+
content.shortcode = '[subscribe2]';
|
158 |
+
}
|
159 |
+
return blocks.createBlock( 'core/shortcode', { text: content.shortcode } );
|
160 |
+
}
|
161 |
+
}
|
162 |
+
],
|
163 |
+
from: [
|
164 |
+
{
|
165 |
+
type: 'block',
|
166 |
+
blocks: [ 'core/shortcode' ],
|
167 |
+
transform: function( content ) {
|
168 |
+
var shortcode, params, param, hide, id, nojs, antispam, size, wrap, link, i;
|
169 |
+
if ( 'subscribe2' === content.text.substr( 1, 10 ) ) {
|
170 |
+
shortcode = content.text;
|
171 |
+
params = content.text.replace( /^\[subscribe2|\]$/g, '' ).replace( /^\s+|\s+$/g, '' ).split( /['"]\s/g );
|
172 |
+
|
173 |
+
for ( i = 0; i < params.length; i++ ) {
|
174 |
+
param = params[i].split( '=' );
|
175 |
+
if ( 'hide' === param[0] ) {
|
176 |
+
hide = param[1].replace( /['"]+/g, '' );
|
177 |
+
}
|
178 |
+
if ( 'id' === param[0] ) {
|
179 |
+
id = param[1].replace( /['"]+/g, '' );
|
180 |
+
}
|
181 |
+
if ( 'nojs' === param[0] ) {
|
182 |
+
nojs = 'true' === param[1].replace( /['"]+/g, '' );
|
183 |
+
}
|
184 |
+
if ( 'antispam' === param[0] ) {
|
185 |
+
antispam = 'true' === param[1].replace( /['"]+/g, '' );
|
186 |
+
}
|
187 |
+
if ( 'size' === param[0] ) {
|
188 |
+
size = param[1].replace( /['"]+/g, '' );
|
189 |
+
}
|
190 |
+
if ( 'wrap' === param[0] ) {
|
191 |
+
wrap = 'false' === param[1].replace( /['"]+/g, '' );
|
192 |
+
}
|
193 |
+
if ( 'link' === param[0] ) {
|
194 |
+
link = param[1].replace( /^['"]|['"]$/g, '' );
|
195 |
+
}
|
196 |
+
}
|
197 |
+
|
198 |
+
return blocks.createBlock( 'subscribe2-html/shortcode', {
|
199 |
+
shortcode: shortcode,
|
200 |
+
hide: hide,
|
201 |
+
id: id,
|
202 |
+
nojs: nojs,
|
203 |
+
antispam: antispam,
|
204 |
+
size: size,
|
205 |
+
wrap: wrap,
|
206 |
+
link: link
|
207 |
+
} );
|
208 |
+
}
|
209 |
+
}
|
210 |
+
},
|
211 |
+
{
|
212 |
+
type: 'shortcode',
|
213 |
+
tag: 'subscribe2',
|
214 |
+
attributes: {
|
215 |
+
shortcode: {
|
216 |
+
type: 'string',
|
217 |
+
selector: 'p'
|
218 |
+
},
|
219 |
+
hide: {
|
220 |
+
type: 'string',
|
221 |
+
shortcode: function( content ) {
|
222 |
+
return content.named.hide || 'none';
|
223 |
+
}
|
224 |
+
},
|
225 |
+
id: {
|
226 |
+
type: 'string',
|
227 |
+
shortcode: function( content ) {
|
228 |
+
return content.named.id || '';
|
229 |
+
}
|
230 |
+
},
|
231 |
+
nojs: {
|
232 |
+
type: 'boolean',
|
233 |
+
shortcode: function( content ) {
|
234 |
+
return content.named.nojs || false;
|
235 |
+
}
|
236 |
+
},
|
237 |
+
antispam: {
|
238 |
+
type: 'boolean',
|
239 |
+
shortcode: function( content ) {
|
240 |
+
return content.named.antispam || false;
|
241 |
+
}
|
242 |
+
},
|
243 |
+
size: {
|
244 |
+
type: 'number',
|
245 |
+
shortcode: function( content ) {
|
246 |
+
return content.named.size || '20';
|
247 |
+
}
|
248 |
+
},
|
249 |
+
wrap: {
|
250 |
+
type: 'boolean',
|
251 |
+
shortcode: function( content ) {
|
252 |
+
return content.named.wrap || false;
|
253 |
+
}
|
254 |
+
},
|
255 |
+
link: {
|
256 |
+
type: 'string',
|
257 |
+
shortcode: function( content ) {
|
258 |
+
return content.named.link || '';
|
259 |
+
}
|
260 |
+
}
|
261 |
+
}
|
262 |
+
}
|
263 |
+
]
|
264 |
+
},
|
265 |
+
edit: function( props ) {
|
266 |
+
var hide = props.attributes.hide || 'none',
|
267 |
+
id = props.attributes.id || '',
|
268 |
+
nojs = props.attributes.nojs || false,
|
269 |
+
antispam = props.attributes.antispam || false,
|
270 |
+
size = props.attributes.size || '20',
|
271 |
+
wrap = props.attributes.wrap || false,
|
272 |
+
link = props.attributes.link || '',
|
273 |
+
isSelected = props.isSelected;
|
274 |
+
|
275 |
+
function onChangeHide( newHide ) {
|
276 |
+
props.attributes.shortcode = s2shortcode( props, 'hide', newHide );
|
277 |
+
props.setAttributes( { hide: newHide } );
|
278 |
+
}
|
279 |
+
function onChangeId( newId ) {
|
280 |
+
props.attributes.shortcode = s2shortcode( props, 'id', newId );
|
281 |
+
props.setAttributes( { id: newId } );
|
282 |
+
}
|
283 |
+
function onChangeNojs( newNojs ) {
|
284 |
+
props.attributes.shortcode = s2shortcode( props, 'nojs', newNojs );
|
285 |
+
props.setAttributes( { nojs: newNojs } );
|
286 |
+
}
|
287 |
+
function onChangeAntispam( newAntispam ) {
|
288 |
+
props.attributes.shortcode = s2shortcode( props, 'antispam', newAntispam );
|
289 |
+
props.setAttributes( { antispam: newAntispam } );
|
290 |
+
}
|
291 |
+
function onChangeSize( newSize ) {
|
292 |
+
props.attributes.shortcode = s2shortcode( props, 'size', newSize );
|
293 |
+
props.setAttributes( { size: newSize } );
|
294 |
+
}
|
295 |
+
function onChangeWrap( newWrap ) {
|
296 |
+
props.attributes.shortcode = s2shortcode( props, 'wrap', newWrap );
|
297 |
+
props.setAttributes( { wrap: newWrap } );
|
298 |
+
}
|
299 |
+
function onChangeLink( newLink ) {
|
300 |
+
props.attributes.shortcode = s2shortcode( props, 'link', newLink );
|
301 |
+
props.setAttributes( { link: newLink } );
|
302 |
+
}
|
303 |
+
|
304 |
+
return [
|
305 |
+
isSelected && el(
|
306 |
+
editor.InspectorControls,
|
307 |
+
{ key: 'subscribe2-html/inspector' },
|
308 |
+
el( 'h3', {}, i18n.__( 'Subscribe2 Shortcode Parameters', 'subscribe2' ) ),
|
309 |
+
el(
|
310 |
+
RadioControl,
|
311 |
+
{
|
312 |
+
label: i18n.__( 'Button Display Options', 'subscribe2' ),
|
313 |
+
selected: hide,
|
314 |
+
onChange: onChangeHide,
|
315 |
+
options: [
|
316 |
+
{ value: 'none', label: i18n.__( 'Show Both Buttons', 'subscribe2' ) },
|
317 |
+
{ value: 'subscribe', label: i18n.__( 'Hide Subscribe Button', 'subscribe2' ) },
|
318 |
+
{ value: 'unsubscribe', label: i18n.__( 'Hide Unsubscribe Button', 'subscribe2' ) }
|
319 |
+
]
|
320 |
+
}
|
321 |
+
),
|
322 |
+
el(
|
323 |
+
TextControl,
|
324 |
+
{
|
325 |
+
type: 'number',
|
326 |
+
label: i18n.__( 'Page ID', 'subscribe2' ),
|
327 |
+
value: id,
|
328 |
+
onChange: onChangeId
|
329 |
+
}
|
330 |
+
),
|
331 |
+
el(
|
332 |
+
CheckboxControl,
|
333 |
+
{
|
334 |
+
label: i18n.__( 'Disable Javascript', 'subscribe2' ),
|
335 |
+
checked: nojs,
|
336 |
+
onChange: onChangeNojs
|
337 |
+
}
|
338 |
+
),
|
339 |
+
el(
|
340 |
+
CheckboxControl,
|
341 |
+
{
|
342 |
+
label: i18n.__( 'Disable Simple Anti-Spam Measures', 'subscribe2' ),
|
343 |
+
checked: antispam,
|
344 |
+
onChange: onChangeAntispam
|
345 |
+
}
|
346 |
+
),
|
347 |
+
el(
|
348 |
+
TextControl,
|
349 |
+
{
|
350 |
+
type: 'number',
|
351 |
+
label: i18n.__( 'Textbox size', 'subscribe2' ),
|
352 |
+
value: size,
|
353 |
+
onChange: onChangeSize
|
354 |
+
}
|
355 |
+
),
|
356 |
+
el(
|
357 |
+
CheckboxControl,
|
358 |
+
{
|
359 |
+
label: i18n.__( 'Disable wrapping of form buttons', 'subscribe2' ),
|
360 |
+
checked: wrap,
|
361 |
+
onChange: onChangeWrap
|
362 |
+
}
|
363 |
+
),
|
364 |
+
el(
|
365 |
+
TextControl,
|
366 |
+
{
|
367 |
+
type: 'string',
|
368 |
+
label: i18n.__( 'Link Text', 'subscribe2' ),
|
369 |
+
value: link,
|
370 |
+
onChange: onChangeLink
|
371 |
+
}
|
372 |
+
)
|
373 |
+
),
|
374 |
+
el(
|
375 |
+
'div', {
|
376 |
+
key: 'subscribe2-html/block',
|
377 |
+
style: { backgroundColor: '#ff0', color: '#000', padding: '2px', 'textAlign': 'center' }
|
378 |
+
}, i18n.__( 'Subscribe2 HTML Shortcode', 'subscribe2' )
|
379 |
+
)
|
380 |
+
];
|
381 |
+
},
|
382 |
+
save: function( props ) {
|
383 |
+
return el( element.RawHTML, null, '<p>' + props.attributes.shortcode + '</p>' );
|
384 |
+
}
|
385 |
+
} );
|
386 |
+
} (
|
387 |
+
window.wp.blocks,
|
388 |
+
window.wp.i18n,
|
389 |
+
window.wp.element,
|
390 |
+
window.wp.components,
|
391 |
+
window.wp.editor
|
392 |
+
) );
|
gutenberg/shortcode.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e,t,s,i,r){var n=s.createElement,o=i.TextControl,a=i.CheckboxControl,c=i.RadioControl;function b(e,t,s){var i=e.attributes||"",r="",n="",o="",a="",c="",b="",u="";switch("subscribe"===i.hide?r=' hide="subscribe"':"unsubscribe"===i.hide&&(r=' hide="unsubscribe"'),""!==i.id&&undefined!==i.id&&(n=' id="'+i.id+'"'),!0===i.nojs&&(o=' nojs="true"'),!0===i.antispam&&(a=' antispam="true"'),""!==i.size&&undefined!==i.size&&"20"!==i.size&&(c=' size="'+i.size+'"'),!0===i.wrap&&(b=' wrap="false"'),""!==i.link&&undefined!==i.link&&(u=' link="'+i.link+'"'),t){case"hide":"none"===s?r="":"subscribe"===s?r=' hide="subscribe"':"unsubscribe"===s&&(r=' hide="unsubscribe"');break;case"id":n=""===s?"":' id="'+s+'"';break;case"nojs":!0===s?o=' nojs="true"':!1===s&&(o="");break;case"antispam":!0===s?a=' antispam="true"':!1===s&&(a="");break;case"size":c="20"===s?"":' size="'+s+'"';break;case"wrap":!0===s?b=' wrap="false"':!1===s&&(b="");break;case"link":u=""===s?"":' link="'+s+'"'}return e.attributes.shortcode="[subscribe2"+r+n+o+a+c+b+u+"]",e.attributes.shortcode}e.registerBlockType("subscribe2-html/shortcode",{title:t.__("Subscribe2 HTML","subscribe2"),icon:"email",category:"widgets",keywords:[t.__("email","subscribe2"),t.__("notification","subscribe2")],supports:{customClassName:!1,className:!1,multiple:!1,html:!1},attributes:{shortcode:{type:"text",selector:"p"},hide:{type:"string"},id:{type:"string"},nojs:{type:"boolean"},antispam:{type:"boolean"},size:{type:"number"},wrap:{type:"boolean"},link:{type:"string"}},transforms:{to:[{type:"block",blocks:["core/shortcode"],transform:function(t){return undefined!==t.shortcode&&""!==t.shortcode||(t.shortcode="[subscribe2]"),e.createBlock("core/shortcode",{text:t.shortcode})}}],from:[{type:"block",blocks:["core/shortcode"],transform:function(t){var s,i,r,n,o,a,c,b,u,l,d;if("subscribe2"===t.text.substr(1,10)){for(s=t.text,i=t.text.replace(/^\[subscribe2|\]$/g,"").replace(/^\s+|\s+$/g,"").split(/['"]\s/g),d=0;d<i.length;d++)"hide"===(r=i[d].split("="))[0]&&(n=r[1].replace(/['"]+/g,"")),"id"===r[0]&&(o=r[1].replace(/['"]+/g,"")),"nojs"===r[0]&&(a="true"===r[1].replace(/['"]+/g,"")),"antispam"===r[0]&&(c="true"===r[1].replace(/['"]+/g,"")),"size"===r[0]&&(b=r[1].replace(/['"]+/g,"")),"wrap"===r[0]&&(u="false"===r[1].replace(/['"]+/g,"")),"link"===r[0]&&(l=r[1].replace(/^['"]|['"]$/g,""));return e.createBlock("subscribe2-html/shortcode",{shortcode:s,hide:n,id:o,nojs:a,antispam:c,size:b,wrap:u,link:l})}}},{type:"shortcode",tag:"subscribe2",attributes:{shortcode:{type:"string",selector:"p"},hide:{type:"string",shortcode:function(e){return e.named.hide||"none"}},id:{type:"string",shortcode:function(e){return e.named.id||""}},nojs:{type:"boolean",shortcode:function(e){return e.named.nojs||!1}},antispam:{type:"boolean",shortcode:function(e){return e.named.antispam||!1}},size:{type:"number",shortcode:function(e){return e.named.size||"20"}},wrap:{type:"boolean",shortcode:function(e){return e.named.wrap||!1}},link:{type:"string",shortcode:function(e){return e.named.link||""}}}}]},edit:function(e){var s=e.attributes.hide||"none",i=e.attributes.id||"",u=e.attributes.nojs||!1,l=e.attributes.antispam||!1,d=e.attributes.size||"20",p=e.attributes.wrap||!1,h=e.attributes.link||"";return[e.isSelected&&n(r.InspectorControls,{key:"subscribe2-html/inspector"},n("h3",{},t.__("Subscribe2 Shortcode Parameters","subscribe2")),n(c,{label:t.__("Button Display Options","subscribe2"),selected:s,onChange:function(t){e.attributes.shortcode=b(e,"hide",t),e.setAttributes({hide:t})},options:[{value:"none",label:t.__("Show Both Buttons","subscribe2")},{value:"subscribe",label:t.__("Hide Subscribe Button","subscribe2")},{value:"unsubscribe",label:t.__("Hide Unsubscribe Button","subscribe2")}]}),n(o,{type:"number",label:t.__("Page ID","subscribe2"),value:i,onChange:function(t){e.attributes.shortcode=b(e,"id",t),e.setAttributes({id:t})}}),n(a,{label:t.__("Disable Javascript","subscribe2"),checked:u,onChange:function(t){e.attributes.shortcode=b(e,"nojs",t),e.setAttributes({nojs:t})}}),n(a,{label:t.__("Disable Simple Anti-Spam Measures","subscribe2"),checked:l,onChange:function(t){e.attributes.shortcode=b(e,"antispam",t),e.setAttributes({antispam:t})}}),n(o,{type:"number",label:t.__("Textbox size","subscribe2"),value:d,onChange:function(t){e.attributes.shortcode=b(e,"size",t),e.setAttributes({size:t})}}),n(a,{label:t.__("Disable wrapping of form buttons","subscribe2"),checked:p,onChange:function(t){e.attributes.shortcode=b(e,"wrap",t),e.setAttributes({wrap:t})}}),n(o,{type:"string",label:t.__("Link Text","subscribe2"),value:h,onChange:function(t){e.attributes.shortcode=b(e,"link",t),e.setAttributes({link:t})}})),n("div",{key:"subscribe2-html/block",style:{backgroundColor:"#ff0",color:"#000",padding:"2px",textAlign:"center"}},t.__("Subscribe2 HTML Shortcode","subscribe2"))]},save:function(e){return n(s.RawHTML,null,"<p>"+e.attributes.shortcode+"</p>")}})}(window.wp.blocks,window.wp.i18n,window.wp.element,window.wp.components,window.wp.editor);
|
gutenberg/sidebar.js
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Version 1.0 - Initial version
|
2 |
+
|
3 |
+
( function( plugins, element, i18n, editPost, components, data, compose, apiFetch ) {
|
4 |
+
var registerPlugin = plugins.registerPlugin,
|
5 |
+
el = element.createElement,
|
6 |
+
__ = i18n.__,
|
7 |
+
Fragment = element.Fragment,
|
8 |
+
PluginSidebar = editPost.PluginSidebar,
|
9 |
+
PluginSidebarMoreMenuItem = editPost.PluginSidebarMoreMenuItem,
|
10 |
+
PanelBody = components.PanelBody,
|
11 |
+
PanelRow = components.PanelRow,
|
12 |
+
CheckboxControl = components.CheckboxControl,
|
13 |
+
Button = components.Button,
|
14 |
+
select = data.select,
|
15 |
+
dispatch = data.dispatch,
|
16 |
+
withSelect = data.withSelect,
|
17 |
+
withDispatch = data.withDispatch,
|
18 |
+
Compose = compose.compose;
|
19 |
+
|
20 |
+
var CheckboxControlMeta = Compose(
|
21 |
+
withSelect( function( select, props ) {
|
22 |
+
var s2mail = select( 'core/editor' ).getEditedPostAttribute( 'meta' )[ props.fieldName ];
|
23 |
+
return {
|
24 |
+
metaChecked: ( 'no' === s2mail ? true : false )
|
25 |
+
};
|
26 |
+
} ),
|
27 |
+
withDispatch( function( dispatch, props ) {
|
28 |
+
return {
|
29 |
+
setMetaChecked: function( value ) {
|
30 |
+
var s2mail = ( true === value ? 'no' : 'yes' );
|
31 |
+
dispatch( 'core/editor' ).editPost( { meta: { [props.fieldName]: s2mail } } );
|
32 |
+
dispatch( 'core/editor' ).savePost();
|
33 |
+
}
|
34 |
+
};
|
35 |
+
} )
|
36 |
+
) ( function( props ) {
|
37 |
+
return el(
|
38 |
+
CheckboxControl,
|
39 |
+
{
|
40 |
+
label: __( 'Check here to disable sending of an email notification for this post/page', 'subscribe2' ),
|
41 |
+
checked: props.metaChecked,
|
42 |
+
onChange: function( content ) {
|
43 |
+
props.setMetaChecked( content );
|
44 |
+
}
|
45 |
+
}
|
46 |
+
);
|
47 |
+
} );
|
48 |
+
|
49 |
+
var buttonClick = function() {
|
50 |
+
var postid = select( 'core/editor' ).getCurrentPostId();
|
51 |
+
apiFetch( { path: '/s2/v1/preview/' + postid } );
|
52 |
+
dispatch( 'core/notices' ).createInfoNotice( __( 'Attempt made to send email preview', 'subscribe2' ) );
|
53 |
+
};
|
54 |
+
|
55 |
+
var s2sidebar = function() {
|
56 |
+
return el(
|
57 |
+
Fragment,
|
58 |
+
{},
|
59 |
+
el(
|
60 |
+
PluginSidebarMoreMenuItem,
|
61 |
+
{
|
62 |
+
target: 's2-sidebar',
|
63 |
+
icon: 'email'
|
64 |
+
},
|
65 |
+
__( 'Subscribe2 Sidebar', 'subscribe2' )
|
66 |
+
),
|
67 |
+
el(
|
68 |
+
PluginSidebar,
|
69 |
+
{
|
70 |
+
name: 's2-sidebar',
|
71 |
+
title: __( 'Subscribe2 Sidebar', 'subscribe2' ),
|
72 |
+
icon: 'email',
|
73 |
+
isPinned: true,
|
74 |
+
isPinnable: true,
|
75 |
+
togglePin: true,
|
76 |
+
togglesidebar: false
|
77 |
+
},
|
78 |
+
el(
|
79 |
+
PanelBody,
|
80 |
+
{
|
81 |
+
title: __( 'Subscribe2 Override', 'subscribe2' ),
|
82 |
+
initialOpen: true
|
83 |
+
},
|
84 |
+
el(
|
85 |
+
PanelRow,
|
86 |
+
{},
|
87 |
+
el(
|
88 |
+
CheckboxControlMeta,
|
89 |
+
{
|
90 |
+
fieldName: '_s2mail'
|
91 |
+
}
|
92 |
+
)
|
93 |
+
)
|
94 |
+
),
|
95 |
+
el(
|
96 |
+
PanelBody,
|
97 |
+
{
|
98 |
+
title: __( 'Subscribe2 Preview', 'subscribe2' ),
|
99 |
+
initialOpen: true
|
100 |
+
},
|
101 |
+
el(
|
102 |
+
PanelRow,
|
103 |
+
{},
|
104 |
+
el(
|
105 |
+
'div',
|
106 |
+
null,
|
107 |
+
__( 'Send preview email of this post to currently logged in user:', 'subscribe2' )
|
108 |
+
)
|
109 |
+
),
|
110 |
+
el(
|
111 |
+
PanelRow,
|
112 |
+
{},
|
113 |
+
el(
|
114 |
+
Button,
|
115 |
+
{
|
116 |
+
isDefault: true,
|
117 |
+
onClick: buttonClick
|
118 |
+
},
|
119 |
+
__( 'Send Preview', 'subscribe2' )
|
120 |
+
)
|
121 |
+
)
|
122 |
+
)
|
123 |
+
)
|
124 |
+
);
|
125 |
+
};
|
126 |
+
|
127 |
+
registerPlugin( 'subscribe2-sidebar', {
|
128 |
+
render: s2sidebar
|
129 |
+
} );
|
130 |
+
} (
|
131 |
+
wp.plugins,
|
132 |
+
wp.element,
|
133 |
+
wp.i18n,
|
134 |
+
wp.editPost,
|
135 |
+
wp.components,
|
136 |
+
wp.data,
|
137 |
+
wp.compose,
|
138 |
+
wp.apiFetch
|
139 |
+
) );
|
gutenberg/sidebar.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e,i,t,n,r,s,o,a){var c=e.registerPlugin,b=i.createElement,d=t.__,l=i.Fragment,u=n.PluginSidebar,p=n.PluginSidebarMoreMenuItem,m=r.PanelBody,g=r.PanelRow,f=r.CheckboxControl,h=r.Button,w=s.select,P=s.dispatch,v=s.withSelect,S=s.withDispatch,C=(0,o.compose)(v(function(e,i){return{metaChecked:"no"===e("core/editor").getEditedPostAttribute("meta")[i.fieldName]}}),S(function(e,i){return{setMetaChecked:function(t){var n=!0===t?"no":"yes";e("core/editor").editPost({meta:{[i.fieldName]:n}}),e("core/editor").savePost()}}}))(function(e){return b(f,{label:d("Check here to disable sending of an email notification for this post/page","subscribe2"),checked:e.metaChecked,onChange:function(i){e.setMetaChecked(i)}})}),k=function(){var e=w("core/editor").getCurrentPostId();a({path:"/s2/v1/preview/"+e}),P("core/notices").createInfoNotice(d("Attempt made to send email preview","subscribe2"))};c("subscribe2-sidebar",{render:function(){return b(l,{},b(p,{target:"s2-sidebar",icon:"email"},d("Subscribe2 Sidebar","subscribe2")),b(u,{name:"s2-sidebar",title:d("Subscribe2 Sidebar","subscribe2"),icon:"email",isPinned:!0,isPinnable:!0,togglePin:!0,togglesidebar:!1},b(m,{title:d("Subscribe2 Override","subscribe2"),initialOpen:!0},b(g,{},b(C,{fieldName:"_s2mail"}))),b(m,{title:d("Subscribe2 Preview","subscribe2"),initialOpen:!0},b(g,{},b("div",null,d("Send preview email of this post to currently logged in user:","subscribe2"))),b(g,{},b(h,{isDefault:!0,onClick:k},d("Send Preview","subscribe2"))))))}})}(wp.plugins,wp.element,wp.i18n,wp.editPost,wp.components,wp.data,wp.compose,wp.apiFetch);
|
subscribe2.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Subscribe2
|
4 |
Plugin URI: https://subscribe2.wordpress.com/
|
5 |
Description: Notifies an email list when new entries are posted.
|
6 |
-
Version: 10.26
|
7 |
Author: Subscribe2
|
8 |
Author URI: https://subscribe2.wordpress.com/
|
9 |
Licence: GPLv3
|
@@ -54,7 +54,7 @@ if ( is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
|
|
54 |
|
55 |
// our version number. Don't touch this or any line below
|
56 |
// unless you know exactly what you are doing
|
57 |
-
define( 'S2VERSION', '10.26' );
|
58 |
define( 'S2PATH', trailingslashit( dirname( __FILE__ ) ) );
|
59 |
define( 'S2DIR', trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) );
|
60 |
define( 'S2URL', plugin_dir_url( dirname( __FILE__ ) ) . S2DIR );
|
3 |
Plugin Name: Subscribe2
|
4 |
Plugin URI: https://subscribe2.wordpress.com/
|
5 |
Description: Notifies an email list when new entries are posted.
|
6 |
+
Version: 10.26.1
|
7 |
Author: Subscribe2
|
8 |
Author URI: https://subscribe2.wordpress.com/
|
9 |
Licence: GPLv3
|
54 |
|
55 |
// our version number. Don't touch this or any line below
|
56 |
// unless you know exactly what you are doing
|
57 |
+
define( 'S2VERSION', '10.26.1' );
|
58 |
define( 'S2PATH', trailingslashit( dirname( __FILE__ ) ) );
|
59 |
define( 'S2DIR', trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) );
|
60 |
define( 'S2URL', plugin_dir_url( dirname( __FILE__ ) ) . S2DIR );
|
subscribe2.pot
CHANGED
@@ -3,7 +3,7 @@ msgid ""
|
|
3 |
msgstr ""
|
4 |
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
5 |
"Project-Id-Version: Subscribe2\n"
|
6 |
-
"POT-Creation-Date: 2019-
|
7 |
"PO-Revision-Date: 2019-01-25 22:54+0100\n"
|
8 |
"Last-Translator: \n"
|
9 |
"Language-Team: \n"
|
@@ -1016,7 +1016,7 @@ msgstr ""
|
|
1016 |
msgid "Subscribe2 Notification Override"
|
1017 |
msgstr ""
|
1018 |
|
1019 |
-
#: classes/class-s2-admin.php:386
|
1020 |
msgid ""
|
1021 |
"Check here to disable sending of an email notification for this post/page"
|
1022 |
msgstr ""
|
@@ -1330,7 +1330,7 @@ msgstr ""
|
|
1330 |
msgid "Disable Anti-spam measures"
|
1331 |
msgstr ""
|
1332 |
|
1333 |
-
#: classes/class-s2-form-widget.php:183
|
1334 |
msgid "Disable wrapping of form buttons"
|
1335 |
msgstr ""
|
1336 |
|
@@ -1601,6 +1601,87 @@ msgstr ""
|
|
1601 |
msgid "Dismiss this notice"
|
1602 |
msgstr ""
|
1603 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1604 |
#: include/options.php:140
|
1605 |
msgid ""
|
1606 |
"{BLOGNAME} has posted a new item, '{TITLE}'\n"
|
3 |
msgstr ""
|
4 |
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
5 |
"Project-Id-Version: Subscribe2\n"
|
6 |
+
"POT-Creation-Date: 2019-02-03 14:02+0100\n"
|
7 |
"PO-Revision-Date: 2019-01-25 22:54+0100\n"
|
8 |
"Last-Translator: \n"
|
9 |
"Language-Team: \n"
|
1016 |
msgid "Subscribe2 Notification Override"
|
1017 |
msgstr ""
|
1018 |
|
1019 |
+
#: classes/class-s2-admin.php:386 gutenberg/gutenberg-translations.php:20
|
1020 |
msgid ""
|
1021 |
"Check here to disable sending of an email notification for this post/page"
|
1022 |
msgstr ""
|
1330 |
msgid "Disable Anti-spam measures"
|
1331 |
msgstr ""
|
1332 |
|
1333 |
+
#: classes/class-s2-form-widget.php:183 gutenberg/gutenberg-translations.php:17
|
1334 |
msgid "Disable wrapping of form buttons"
|
1335 |
msgstr ""
|
1336 |
|
1601 |
msgid "Dismiss this notice"
|
1602 |
msgstr ""
|
1603 |
|
1604 |
+
#: gutenberg/gutenberg-translations.php:5
|
1605 |
+
msgid "Subscribe2 HTML"
|
1606 |
+
msgstr ""
|
1607 |
+
|
1608 |
+
#: gutenberg/gutenberg-translations.php:6
|
1609 |
+
msgid "email"
|
1610 |
+
msgstr ""
|
1611 |
+
|
1612 |
+
#: gutenberg/gutenberg-translations.php:7
|
1613 |
+
msgid "notification"
|
1614 |
+
msgstr ""
|
1615 |
+
|
1616 |
+
#: gutenberg/gutenberg-translations.php:8
|
1617 |
+
msgid "Subscribe2 Shortcode Parameters"
|
1618 |
+
msgstr ""
|
1619 |
+
|
1620 |
+
#: gutenberg/gutenberg-translations.php:9
|
1621 |
+
msgid "Button Display Options"
|
1622 |
+
msgstr ""
|
1623 |
+
|
1624 |
+
#: gutenberg/gutenberg-translations.php:10
|
1625 |
+
msgid "Show Both Buttons"
|
1626 |
+
msgstr ""
|
1627 |
+
|
1628 |
+
#: gutenberg/gutenberg-translations.php:11
|
1629 |
+
msgid "Hide Subscribe Button"
|
1630 |
+
msgstr ""
|
1631 |
+
|
1632 |
+
#: gutenberg/gutenberg-translations.php:12
|
1633 |
+
msgid "Hide Unsubscribe Button"
|
1634 |
+
msgstr ""
|
1635 |
+
|
1636 |
+
#: gutenberg/gutenberg-translations.php:13
|
1637 |
+
msgid "Page ID"
|
1638 |
+
msgstr ""
|
1639 |
+
|
1640 |
+
#: gutenberg/gutenberg-translations.php:14
|
1641 |
+
msgid "Disable Javascript"
|
1642 |
+
msgstr ""
|
1643 |
+
|
1644 |
+
#: gutenberg/gutenberg-translations.php:15
|
1645 |
+
msgid "Disable Simple Anti-Spam Measures"
|
1646 |
+
msgstr ""
|
1647 |
+
|
1648 |
+
#: gutenberg/gutenberg-translations.php:16
|
1649 |
+
msgid "Textbox size"
|
1650 |
+
msgstr ""
|
1651 |
+
|
1652 |
+
#: gutenberg/gutenberg-translations.php:18
|
1653 |
+
msgid "Link Text"
|
1654 |
+
msgstr ""
|
1655 |
+
|
1656 |
+
#: gutenberg/gutenberg-translations.php:19
|
1657 |
+
msgid "Subscribe2 HTML Shortcode"
|
1658 |
+
msgstr ""
|
1659 |
+
|
1660 |
+
#: gutenberg/gutenberg-translations.php:21
|
1661 |
+
msgid "Attempt made to send email preview"
|
1662 |
+
msgstr ""
|
1663 |
+
|
1664 |
+
#: gutenberg/gutenberg-translations.php:22
|
1665 |
+
#: gutenberg/gutenberg-translations.php:23
|
1666 |
+
msgid "Subscribe2 Sidebar"
|
1667 |
+
msgstr ""
|
1668 |
+
|
1669 |
+
#: gutenberg/gutenberg-translations.php:24
|
1670 |
+
msgid "Subscribe2 Override"
|
1671 |
+
msgstr ""
|
1672 |
+
|
1673 |
+
#: gutenberg/gutenberg-translations.php:25
|
1674 |
+
msgid "Subscribe2 Preview"
|
1675 |
+
msgstr ""
|
1676 |
+
|
1677 |
+
#: gutenberg/gutenberg-translations.php:26
|
1678 |
+
msgid "Send preview email of this post to currently logged in user:"
|
1679 |
+
msgstr ""
|
1680 |
+
|
1681 |
+
#: gutenberg/gutenberg-translations.php:27
|
1682 |
+
msgid "Send Preview"
|
1683 |
+
msgstr ""
|
1684 |
+
|
1685 |
#: include/options.php:140
|
1686 |
msgid ""
|
1687 |
"{BLOGNAME} has posted a new item, '{TITLE}'\n"
|