Subscribe2 - Version 10.37

Version Description

(23rd November, 2021) =

  • Fix HTML widgets issue
  • Fix logged-in user can see subscription form
Download this release

Release Info

Developer tareq1988
Plugin Icon 128x128 Subscribe2
Version 10.37
Comparing to
See all releases

Code changes from version 10.36 to 10.37

admin/subscribers.php CHANGED
@@ -83,14 +83,14 @@ if ( isset( $_POST['s2_admin'] ) ) {
83
  } elseif ( isset( $_POST['remind'] ) ) {
84
  $this->remind( $_POST['reminderemails'] );
85
  echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Reminder Email(s) Sent!', 'subscribe2' ) . '</strong></p></div>';
86
- } elseif ( isset( $_POST['sub_categories'] ) && 'subscribe' === $_POST['manage'] ) {
87
  if ( isset( $_REQUEST['subscriber'] ) ) {
88
  $this->subscribe_registered_users( implode( ",\r\n", $_REQUEST['subscriber'] ), $s2_request_category );
89
  } else {
90
  $this->subscribe_registered_users( $_POST['exportcsv'], $s2_request_category );
91
  }
92
  echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Registered Users Subscribed!', 'subscribe2' ) . '</strong></p></div>';
93
- } elseif ( isset( $_POST['sub_categories'] ) && 'unsubscribe' === $_POST['manage'] ) {
94
  if ( isset( $_REQUEST['subscriber'] ) ) {
95
  $this->unsubscribe_registered_users( implode( ",\r\n", $_REQUEST['subscriber'] ), $s2_request_category );
96
  } else {
83
  } elseif ( isset( $_POST['remind'] ) ) {
84
  $this->remind( $_POST['reminderemails'] );
85
  echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Reminder Email(s) Sent!', 'subscribe2' ) . '</strong></p></div>';
86
+ } elseif ( isset( $_POST['sub_categories'] ) && 'subscribe' === (isset($_POST['manage']) ? $_POST['manage'] : '') ) {
87
  if ( isset( $_REQUEST['subscriber'] ) ) {
88
  $this->subscribe_registered_users( implode( ",\r\n", $_REQUEST['subscriber'] ), $s2_request_category );
89
  } else {
90
  $this->subscribe_registered_users( $_POST['exportcsv'], $s2_request_category );
91
  }
92
  echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Registered Users Subscribed!', 'subscribe2' ) . '</strong></p></div>';
93
+ } elseif ( isset( $_POST['sub_categories'] ) && 'unsubscribe' === (isset($_POST['manage']) ? $_POST['manage'] : '') ) {
94
  if ( isset( $_REQUEST['subscriber'] ) ) {
95
  $this->unsubscribe_registered_users( implode( ",\r\n", $_REQUEST['subscriber'] ), $s2_request_category );
96
  } else {
changelog.txt CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  = 10.36 (30th September, 2021) =
2
 
3
  * WordPress 5.8 compatibility
1
+ = 10.37 (23rd November, 2021) =
2
+
3
+ * Fix HTML widgets issue
4
+ * Fix logged-in user can see subscription form
5
+
6
  = 10.36 (30th September, 2021) =
7
 
8
  * WordPress 5.8 compatibility
classes/class-s2-frontend.php CHANGED
@@ -1,54 +1,5 @@
1
  <?php
2
  class S2_Frontend extends S2_Core {
3
- /**
4
- * Load all our strings
5
- */
6
- public function load_strings() {
7
- // Translators: Link to login page
8
- $this->please_log_in = '<p class="s2_message">' . sprintf( __( 'To manage your subscription options please <a href="%1$s">login</a>.', 'subscribe2' ), get_option( 'siteurl' ) . '/wp-login.php' ) . '</p>';
9
-
10
- $profile = apply_filters( 's2_profile_link', get_option( 'siteurl' ) . '/wp-admin/admin.php?page=s2' );
11
- // Translators: Link to Profile page
12
- $this->profile = '<p class="s2_message">' . sprintf( __( 'You may manage your subscription options from your <a href="%1$s">profile</a>.', 'subscribe2' ), $profile ) . '</p>';
13
- if ( true === $this->s2_mu ) {
14
- global $blog_id;
15
- $user_ID = get_current_user_id();
16
- if ( ! is_user_member_of_blog( $user_ID, $blog_id ) ) {
17
- // if we are on multisite and the user is not a member of this blog change the link
18
- $mu_profile = apply_filters( 's2_mu_profile_link', get_option( 'siteurl' ) . '/wp-admin/?s2mu_subscribe=' . $blog_id );
19
- // Translators: Link to Profile page
20
- $this->profile = '<p class="s2_message">' . sprintf( __( '<a href="%1$s">Subscribe</a> to email notifications when this blog posts new content.', 'subscribe2' ), $mu_profile ) . '</p>';
21
- }
22
- }
23
-
24
- $this->confirmation_sent = '<p class="s2_message">' . __( 'A confirmation message is on its way!', 'subscribe2' ) . '</p>';
25
-
26
- $this->already_subscribed = '<p class="s2_error">' . __( 'That email address is already subscribed.', 'subscribe2' ) . '</p>';
27
-
28
- $this->not_subscribed = '<p class="s2_error">' . __( 'That email address is not subscribed.', 'subscribe2' ) . '</p>';
29
-
30
- $this->not_an_email = '<p class="s2_error">' . __( 'Sorry, but that does not look like an email address to me.', 'subscribe2' ) . '</p>';
31
-
32
- $this->barred_domain = '<p class="s2_error">' . __( 'Sorry, email addresses at that domain are currently barred due to spam, please use an alternative email address.', 'subscribe2' ) . '</p>';
33
-
34
- $this->error = '<p class="s2_error">' . __( 'Sorry, there seems to be an error on the server. Please try again later.', 'subscribe2' ) . '</p>';
35
-
36
- // confirmation messages
37
- $this->no_such_email = '<p class="s2_error">' . __( 'No such email address is registered.', 'subscribe2' ) . '</p>';
38
-
39
- $this->added = '<p class="s2_message">' . __( 'You have successfully subscribed!', 'subscribe2' ) . '</p>';
40
-
41
- $this->deleted = '<p class="s2_message">' . __( 'You have successfully unsubscribed.', 'subscribe2' ) . '</p>';
42
-
43
- $this->subscribe = __( 'subscribe', 'subscribe2' ); //ACTION replacement in subscribing confirmation email
44
-
45
- $this->unsubscribe = __( 'unsubscribe', 'subscribe2' ); //ACTION replacement in unsubscribing in confirmation email
46
-
47
- if ( isset( $_GET['s2_unsub'] ) && ! empty( $_GET['s2_unsub'] ) ) {
48
- $this->unsubscribe( $_GET['s2_unsub'] );
49
- }
50
- }
51
-
52
  /**
53
  * Process unsubscribe
54
  *
@@ -343,9 +294,6 @@ class S2_Frontend extends S2_Core {
343
  return $tag;
344
  }
345
 
346
- /* ===== define some variables ===== */
347
- public $profile = '';
348
-
349
 
350
  /**
351
  * Create and display a dropdown list of pages
1
  <?php
2
  class S2_Frontend extends S2_Core {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  /**
4
  * Process unsubscribe
5
  *
294
  return $tag;
295
  }
296
 
 
 
 
297
 
298
  /**
299
  * Create and display a dropdown list of pages
gutenberg/shortcode.js CHANGED
@@ -388,7 +388,7 @@
388
  ];
389
  },
390
  save: function( props ) {
391
- return el( element.RawHTML, null, '<p>' + props.attributes.shortcode + '</p>' );
392
  }
393
  }
394
  );
388
  ];
389
  },
390
  save: function( props ) {
391
+ return el( element.RawHTML, null, '<p>' + s2shortcode(props) + '</p>' );
392
  }
393
  }
394
  );
gutenberg/shortcode.min.js CHANGED
@@ -1 +1,32 @@
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,p;if("subscribe2"===t.text.substr(1,10)){for(s=t.text,p=(i=t.text.replace(/^\[subscribe2|\]$/g,"").replace(/^\s+|\s+$/g,"").split(/['"]\s/g)).length,d=0;d<p;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);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function(blocks,i18n,element,components,editor){var el=element.createElement,TextControl=components.TextControl,CheckboxControl=components.CheckboxControl,RadioControl=components.RadioControl;function s2shortcode(props,control,newVal){var attributes=props.attributes||'';var hide='',id='',nojs='',antispam='',size='',wrap='',link='';if('subscribe'===attributes.hide){hide=' hide="subscribe"'}else if('unsubscribe'===attributes.hide){hide=' hide="unsubscribe"'}
2
+ if(''!==attributes.id&&undefined!==attributes.id){id=' id="'+attributes.id+'"'}
3
+ if(!0===attributes.nojs){nojs=' nojs="true"'}
4
+ if(!0===attributes.antispam){antispam=' antispam="true"'}
5
+ if(''!==attributes.size&&undefined!==attributes.size&&'20'!==attributes.size){size=' size="'+attributes.size+'"'}
6
+ if(!0===attributes.wrap){wrap=' wrap="false"'}
7
+ if(''!==attributes.link&&undefined!==attributes.link){link=' link="'+attributes.link+'"'}
8
+ switch(control){case 'hide':if('none'===newVal){hide=''}else if('subscribe'===newVal){hide=' hide="subscribe"'}else if('unsubscribe'===newVal){hide=' hide="unsubscribe"'}
9
+ break;case 'id':if(''===newVal){id=''}else{id=' id="'+newVal+'"'}
10
+ break;case 'nojs':if(!0===newVal){nojs=' nojs="true"'}else if(!1===newVal){nojs=''}
11
+ break;case 'antispam':if(!0===newVal){antispam=' antispam="true"'}else if(!1===newVal){antispam=''}
12
+ break;case 'size':if('20'===newVal){size=''}else{size=' size="'+newVal+'"'}
13
+ break;case 'wrap':if(!0===newVal){wrap=' wrap="false"'}else if(!1===newVal){wrap=''}
14
+ break;case 'link':if(''===newVal){link=''}else{link=' link="'+newVal+'"'}
15
+ break;default:break}
16
+ props.attributes.shortcode='[subscribe2'+hide+id+nojs+antispam+size+wrap+link+']';return props.attributes.shortcode}
17
+ blocks.registerBlockType('subscribe2-html/shortcode',{title:i18n.__('Subscribe2 HTML','subscribe2'),icon:'email',category:'widgets',keywords:[i18n.__('email','subscribe2'),i18n.__('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(content){if(undefined===content.shortcode||''===content.shortcode){content.shortcode='[subscribe2]'}
18
+ return blocks.createBlock('core/shortcode',{text:content.shortcode})}}],from:[{type:'block',blocks:['core/shortcode'],transform:function(content){var shortcode,params,param,hide,id,nojs,antispam,size,wrap,link,i,l;if('subscribe2'===content.text.substr(1,10)){shortcode=content.text;params=content.text.replace(/^\[subscribe2|\]$/g,'').replace(/^\s+|\s+$/g,'').split(/['"]\s/g);l=params.length;for(i=0;i<l;i++){param=params[i].split('=');if('hide'===param[0]){hide=param[1].replace(/['"]+/g,'')}
19
+ if('id'===param[0]){id=param[1].replace(/['"]+/g,'')}
20
+ if('nojs'===param[0]){nojs='true'===param[1].replace(/['"]+/g,'')}
21
+ if('antispam'===param[0]){antispam='true'===param[1].replace(/['"]+/g,'')}
22
+ if('size'===param[0]){size=param[1].replace(/['"]+/g,'')}
23
+ if('wrap'===param[0]){wrap='false'===param[1].replace(/['"]+/g,'')}
24
+ if('link'===param[0]){link=param[1].replace(/^['"]|['"]$/g,'')}}
25
+ return blocks.createBlock('subscribe2-html/shortcode',{shortcode:shortcode,hide:hide,id:id,nojs:nojs,antispam:antispam,size:size,wrap:wrap,link:link})}}},{type:'shortcode',tag:'subscribe2',attributes:{shortcode:{type:'string',selector:'p'},hide:{type:'string',shortcode:function(content){return content.named.hide||'none'}},id:{type:'string',shortcode:function(content){return content.named.id||''}},nojs:{type:'boolean',shortcode:function(content){return content.named.nojs||!1}},antispam:{type:'boolean',shortcode:function(content){return content.named.antispam||!1}},size:{type:'number',shortcode:function(content){return content.named.size||'20'}},wrap:{type:'boolean',shortcode:function(content){return content.named.wrap||!1}},link:{type:'string',shortcode:function(content){return content.named.link||''}}}}]},edit:function(props){var hide=props.attributes.hide||'none',id=props.attributes.id||'',nojs=props.attributes.nojs||!1,antispam=props.attributes.antispam||!1,size=props.attributes.size||'20',wrap=props.attributes.wrap||!1,link=props.attributes.link||'',isSelected=props.isSelected;function onChangeHide(newHide){props.attributes.shortcode=s2shortcode(props,'hide',newHide);props.setAttributes({hide:newHide})}
26
+ function onChangeId(newId){props.attributes.shortcode=s2shortcode(props,'id',newId);props.setAttributes({id:newId})}
27
+ function onChangeNojs(newNojs){props.attributes.shortcode=s2shortcode(props,'nojs',newNojs);props.setAttributes({nojs:newNojs})}
28
+ function onChangeAntispam(newAntispam){props.attributes.shortcode=s2shortcode(props,'antispam',newAntispam);props.setAttributes({antispam:newAntispam})}
29
+ function onChangeSize(newSize){props.attributes.shortcode=s2shortcode(props,'size',newSize);props.setAttributes({size:newSize})}
30
+ function onChangeWrap(newWrap){props.attributes.shortcode=s2shortcode(props,'wrap',newWrap);props.setAttributes({wrap:newWrap})}
31
+ function onChangeLink(newLink){props.attributes.shortcode=s2shortcode(props,'link',newLink);props.setAttributes({link:newLink})}
32
+ return[isSelected&&el(editor.InspectorControls,{key:'subscribe2-html/inspector'},el('h3',{},i18n.__('Subscribe2 Shortcode Parameters','subscribe2')),el(RadioControl,{label:i18n.__('Button Display Options','subscribe2'),selected:hide,onChange:onChangeHide,options:[{value:'none',label:i18n.__('Show Both Buttons','subscribe2')},{value:'subscribe',label:i18n.__('Hide Subscribe Button','subscribe2')},{value:'unsubscribe',label:i18n.__('Hide Unsubscribe Button','subscribe2')}]}),el(TextControl,{type:'number',label:i18n.__('Page ID','subscribe2'),value:id,onChange:onChangeId}),el(CheckboxControl,{label:i18n.__('Disable Javascript','subscribe2'),checked:nojs,onChange:onChangeNojs}),el(CheckboxControl,{label:i18n.__('Disable Simple Anti-Spam Measures','subscribe2'),checked:antispam,onChange:onChangeAntispam}),el(TextControl,{type:'number',label:i18n.__('Textbox size','subscribe2'),value:size,onChange:onChangeSize}),el(CheckboxControl,{label:i18n.__('Disable wrapping of form buttons','subscribe2'),checked:wrap,onChange:onChangeWrap}),el(TextControl,{type:'string',label:i18n.__('Link Text','subscribe2'),value:link,onChange:onChangeLink})),el('div',{key:'subscribe2-html/block',style:{backgroundColor:'#ff0',color:'#000',padding:'2px','textAlign':'center'}},i18n.__('Subscribe2 HTML Shortcode','subscribe2'))]},save:function(props){return el(element.RawHTML,null,'<p>'+s2shortcode(props)+'</p>')}})}(window.wp.blocks,window.wp.i18n,window.wp.element,window.wp.components,window.wp.editor))
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://getwemail.io
4
  Tags: posts, subscription, email, subscribe, notify, notification, newsletter, post notification, email marketing, optin, form
5
  Requires at least: 4.0
6
  Tested up to: 5.8
7
- Stable tag: 10.36
8
  Requires PHP: 5.4
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
@@ -72,6 +72,11 @@ This token will automatically be replaced by dynamic subscription information an
72
 
73
  == Changelog ==
74
 
 
 
 
 
 
75
  = 10.36 (30th September, 2021) =
76
 
77
  * WordPress 5.8 compatibility
4
  Tags: posts, subscription, email, subscribe, notify, notification, newsletter, post notification, email marketing, optin, form
5
  Requires at least: 4.0
6
  Tested up to: 5.8
7
+ Stable tag: 10.37
8
  Requires PHP: 5.4
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
72
 
73
  == Changelog ==
74
 
75
+ = 10.37 (23rd November, 2021) =
76
+
77
+ * Fix HTML widgets issue
78
+ * Fix logged-in user can see subscription form
79
+
80
  = 10.36 (30th September, 2021) =
81
 
82
  * WordPress 5.8 compatibility
subscribe2.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Subscribe2
4
  Plugin URI: https://getwemail.io
5
  Description: Notifies an email list when new entries are posted.
6
- Version: 10.36
7
  Author: weMail
8
  Author URI: https://getwemail.io
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.36' );
58
  define( 'S2PLUGIN', __FILE__ );
59
  define( 'S2PATH', trailingslashit( dirname( __FILE__ ) ) );
60
  define( 'S2DIR', trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) );
3
  Plugin Name: Subscribe2
4
  Plugin URI: https://getwemail.io
5
  Description: Notifies an email list when new entries are posted.
6
+ Version: 10.37
7
  Author: weMail
8
  Author URI: https://getwemail.io
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.37' );
58
  define( 'S2PLUGIN', __FILE__ );
59
  define( 'S2PATH', trailingslashit( dirname( __FILE__ ) ) );
60
  define( 'S2DIR', trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) );
traits/ShortcodeTrait.php CHANGED
@@ -1,6 +1,58 @@
1
  <?php
2
 
3
  trait Shortcode {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  /* ===== template and filter functions ===== */
5
  /**
6
  * Display our form; also handles (un)subscribe requests
@@ -114,6 +166,10 @@ trait Shortcode {
114
  }
115
  $this->s2form = apply_filters( 's2_form', $this->form, $args );
116
 
 
 
 
 
117
  if ( isset( $_POST['subscribe'] ) || isset( $_POST['unsubscribe'] ) ) {
118
  // anti spam sign up measure
119
  if ( ( isset( $_POST['firstname'] ) && '' !== $_POST['firstname'] ) || ( isset( $_POST['lastname'] ) && '' !== $_POST['lastname'] ) || ( isset( $_POST['uri'] ) && 'http://' !== $_POST['uri'] ) ) {
1
  <?php
2
 
3
  trait Shortcode {
4
+ /* ===== define some variables ===== */
5
+ public $profile = '';
6
+
7
+ /**
8
+ * Load all our strings
9
+ */
10
+ public function load_strings() {
11
+ // Translators: Link to login page
12
+ $this->please_log_in = '<p class="s2_message">' . sprintf( __( 'To manage your subscription options please <a href="%1$s">login</a>.', 'subscribe2' ), get_option( 'siteurl' ) . '/wp-login.php' ) . '</p>';
13
+
14
+ $profile = apply_filters( 's2_profile_link', get_option( 'siteurl' ) . '/wp-admin/admin.php?page=s2' );
15
+ // Translators: Link to Profile page
16
+ $this->profile = '<p class="s2_message">' . sprintf( __( 'You may manage your subscription options from your <a href="%1$s">profile</a>.', 'subscribe2' ), $profile ) . '</p>';
17
+ if ( true === $this->s2_mu ) {
18
+ global $blog_id;
19
+ $user_ID = get_current_user_id();
20
+ if ( ! is_user_member_of_blog( $user_ID, $blog_id ) ) {
21
+ // if we are on multisite and the user is not a member of this blog change the link
22
+ $mu_profile = apply_filters( 's2_mu_profile_link', get_option( 'siteurl' ) . '/wp-admin/?s2mu_subscribe=' . $blog_id );
23
+ // Translators: Link to Profile page
24
+ $this->profile = '<p class="s2_message">' . sprintf( __( '<a href="%1$s">Subscribe</a> to email notifications when this blog posts new content.', 'subscribe2' ), $mu_profile ) . '</p>';
25
+ }
26
+ }
27
+
28
+ $this->confirmation_sent = '<p class="s2_message">' . __( 'A confirmation message is on its way!', 'subscribe2' ) . '</p>';
29
+
30
+ $this->already_subscribed = '<p class="s2_error">' . __( 'That email address is already subscribed.', 'subscribe2' ) . '</p>';
31
+
32
+ $this->not_subscribed = '<p class="s2_error">' . __( 'That email address is not subscribed.', 'subscribe2' ) . '</p>';
33
+
34
+ $this->not_an_email = '<p class="s2_error">' . __( 'Sorry, but that does not look like an email address to me.', 'subscribe2' ) . '</p>';
35
+
36
+ $this->barred_domain = '<p class="s2_error">' . __( 'Sorry, email addresses at that domain are currently barred due to spam, please use an alternative email address.', 'subscribe2' ) . '</p>';
37
+
38
+ $this->error = '<p class="s2_error">' . __( 'Sorry, there seems to be an error on the server. Please try again later.', 'subscribe2' ) . '</p>';
39
+
40
+ // confirmation messages
41
+ $this->no_such_email = '<p class="s2_error">' . __( 'No such email address is registered.', 'subscribe2' ) . '</p>';
42
+
43
+ $this->added = '<p class="s2_message">' . __( 'You have successfully subscribed!', 'subscribe2' ) . '</p>';
44
+
45
+ $this->deleted = '<p class="s2_message">' . __( 'You have successfully unsubscribed.', 'subscribe2' ) . '</p>';
46
+
47
+ $this->subscribe = __( 'subscribe', 'subscribe2' ); //ACTION replacement in subscribing confirmation email
48
+
49
+ $this->unsubscribe = __( 'unsubscribe', 'subscribe2' ); //ACTION replacement in unsubscribing in confirmation email
50
+
51
+ if ( isset( $_GET['s2_unsub'] ) && ! empty( $_GET['s2_unsub'] ) ) {
52
+ $this->unsubscribe( $_GET['s2_unsub'] );
53
+ }
54
+ }
55
+
56
  /* ===== template and filter functions ===== */
57
  /**
58
  * Display our form; also handles (un)subscribe requests
166
  }
167
  $this->s2form = apply_filters( 's2_form', $this->form, $args );
168
 
169
+ if ( is_user_logged_in() ) {
170
+ return $this->profile;
171
+ }
172
+
173
  if ( isset( $_POST['subscribe'] ) || isset( $_POST['unsubscribe'] ) ) {
174
  // anti spam sign up measure
175
  if ( ( isset( $_POST['firstname'] ) && '' !== $_POST['firstname'] ) || ( isset( $_POST['lastname'] ) && '' !== $_POST['lastname'] ) || ( isset( $_POST['uri'] ) && 'http://' !== $_POST['uri'] ) ) {