Subscribe2 - Version 10.20.5

Version Description

Download this release

Release Info

Developer tanaylakhani
Plugin Icon 128x128 Subscribe2
Version 10.20.5
Comparing to
See all releases

Code changes from version 10.20.4 to 10.20.5

ChangeLog.txt CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  = 10.20.4 =
2
 
3
  * Bug Fix for readygraph
1
+ = 10.20.5 =
2
+
3
+ * Make monetization absolutely optional and opt-in
4
+ * Turn on monetization only after they register for ReadyGraph
5
+
6
  = 10.20.4 =
7
 
8
  * Bug Fix for readygraph
ReadMe.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://plugins.readygraph.com/donate/
4
  Tags: posts, subscription, email, subscribe, notify, notification
5
  Requires at least: 3.3
6
  Tested up to: 4.1
7
- Stable tag: 10.20.4
8
  License: GPL3
9
 
10
  Sends a list of subscribers emails when you publish new posts. Automate user growth and revenue with ReadyGraph integration.
4
  Tags: posts, subscription, email, subscribe, notify, notification
5
  Requires at least: 3.3
6
  Tested up to: 4.1
7
+ Stable tag: 10.20.5
8
  License: GPL3
9
 
10
  Sends a list of subscribers emails when you publish new posts. Automate user growth and revenue with ReadyGraph integration.
extension/readygraph/admin.php CHANGED
@@ -13,7 +13,7 @@
13
  */
14
 
15
  include("header.php");
16
- if (!get_option('readygraph_application_id') || strlen(get_option('readygraph_application_id')) <= 0)s2_rg_connect();
17
  if(isset($_GET["tutorial"]) && $_GET["tutorial"] == "true"){update_option('readygraph_tutorial',"true");}
18
  else{update_option('readygraph_tutorial',"false");}
19
  if(isset($_GET["readygraph_upgrade_notice"]) && $_GET["readygraph_upgrade_notice"] == "dismiss") {update_option('readygraph_upgrade_notice', 'false');}
@@ -204,11 +204,7 @@ include("header.php");
204
 
205
  <script type="text/javascript" charset="utf-8">
206
  var enable_monetize;
207
- if(document.getElementById('readygraph_monetize').checked) {
208
- enable_monetize = true;
209
- } else {
210
- enable_monetize = false;
211
- }
212
 
213
  function subscribe_readygraph() {
214
  var radios = document.getElementsByName("select-plan");
13
  */
14
 
15
  include("header.php");
16
+ /*if (!get_option('readygraph_application_id') || strlen(get_option('readygraph_application_id')) <= 0)s2_rg_connect();*/
17
  if(isset($_GET["tutorial"]) && $_GET["tutorial"] == "true"){update_option('readygraph_tutorial',"true");}
18
  else{update_option('readygraph_tutorial',"false");}
19
  if(isset($_GET["readygraph_upgrade_notice"]) && $_GET["readygraph_upgrade_notice"] == "dismiss") {update_option('readygraph_upgrade_notice', 'false');}
204
 
205
  <script type="text/javascript" charset="utf-8">
206
  var enable_monetize;
207
+
 
 
 
 
208
 
209
  function subscribe_readygraph() {
210
  var radios = document.getElementsByName("select-plan");
extension/readygraph/footer.php CHANGED
@@ -69,29 +69,19 @@
69
  });
70
 
71
  $("a.connect").click(function() {
 
 
 
 
 
72
  if (enable_monetize){
73
- if(app_id.length > 0) {
74
- $.ajax({
75
- url: resourceHost + '/api/v1/wp-monetize/'
76
- , method: 'POST'
77
- , data: {
78
- app_id: $('[name="readygraph_application_id"]').val(),
79
- monetize: "true",
80
- client_id: settings.clientId
81
- }
82
- , success: function (response) {
83
- var monetize_adsoptimal_id = response.data.adsoptimal_id;
84
- var monetize_adsoptimal_secret = response.data.adsoptimal_secret;
85
- jQuery.post(ajaxurl,{action : 's2-myajax-submit',readygraph_monetize : "true",adsoptimal_id : monetize_adsoptimal_id, adsoptimal_secret : monetize_adsoptimal_secret},function() {});
86
- /* future processing for sites opted in for monetization */
87
- }
88
- , error: function (response) {
89
- console.log(response);
90
- /* future process */
91
  }
92
- });}
 
 
93
  }
94
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token&app_id='+app_id+'&app_secret='+app_secret;
95
  openPopup(url);
96
  $(document.body).bind('focus', parent_disable);
97
  $(document.body).bind('click', parent_disable);
@@ -217,7 +207,7 @@
217
  $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
218
  }
219
  , error: function (response) {
220
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
221
  $('div.authenticate').show();
222
  $('div.authenticating').hide();
223
  $('div.authenticated').hide();
69
  });
70
 
71
  $("a.connect").click(function() {
72
+ if(document.getElementById('readygraph_monetize').checked) {
73
+ enable_monetize = true;
74
+ } else {
75
+ enable_monetize = false;
76
+ }
77
  if (enable_monetize){
78
+ $.post(ajaxurl,{action : 's2-myajax-submit',readygraph_monetize : "true"},function() {});
79
+ var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token&monetization=true';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  }
81
+ else{
82
+ $.post(ajaxurl,{action : 's2-myajax-submit',readygraph_monetize : "false"},function() {});
83
+ var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
84
  }
 
85
  openPopup(url);
86
  $(document.body).bind('focus', parent_disable);
87
  $(document.body).bind('click', parent_disable);
207
  $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
208
  }
209
  , error: function (response) {
210
+ alert('We couldn\'t authenticate your account. Please re-connect to ReadyGraph using different browser');
211
  $('div.authenticate').show();
212
  $('div.authenticating').hide();
213
  $('div.authenticated').hide();
readygraph-extension.php CHANGED
@@ -10,7 +10,7 @@
10
  function s2_myajax_submit() {
11
  if ($_POST['adsoptimal_id']) update_option('readygraph_adsoptimal_id',$_POST['adsoptimal_id']);
12
  if ($_POST['adsoptimal_secret']) update_option('readygraph_adsoptimal_secret',$_POST['adsoptimal_secret']);
13
- if ($_POST['readygraph_monetize'] && $_POST['readygraph_monetize']== "true") update_option('readygraph_enable_monetize',$_POST['readygraph_monetize']);
14
  $email = $_POST['email'];
15
  if ($email){
16
  global $wpdb;
@@ -137,7 +137,7 @@ function add_s2_readygraph_plugin_warning() {
137
 
138
  add_action('admin_notices', 'add_s2_readygraph_plugin_warning');
139
  if(get_option('readygraph_application_id') && strlen(get_option('readygraph_application_id')) > 0){
140
- if ((get_option('readygraph_access_token') && strlen(get_option('readygraph_access_token')) > 0) || (get_option('readygraph_enable_monetize') && get_option('readygraph_enable_monetize') == "true")){
141
  add_action('wp_footer', 's2_readygraph_client_script_head', 5);
142
  }
143
  }
@@ -241,35 +241,6 @@ function s2_wordpress_sync_users() {
241
  }
242
  }
243
  }
244
- function s2_rg_connect(){
245
- if(get_option('readygraph_connect_anonymous') != "true"){
246
- $url = 'https://readygraph.com/api/v1/wordpress-rg-connect-anonymous/';
247
- $randon_string = s2_get_random_string();
248
- $response = wp_remote_post($url, array( 'body' => array('app_secret' => $randon_string, 'website' => home_url())));
249
- if ( is_wp_error( $response ) ) {
250
- $error_message = $response->get_error_message();
251
- } else {
252
- $result = json_decode($response['body'],true);
253
- $app_id = $result['data']['app_id'];
254
- update_option('readygraph_connect_anonymous', 'true');
255
- update_option('readygraph_application_id', $app_id);
256
- update_option('readygraph_connect_anonymous_app_secret', $randon_string);
257
- }
258
- }
259
- }
260
- function s2_get_random_string()
261
- {
262
- $valid_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
263
- $length = 10;
264
- $random_string = "";
265
- $num_valid_chars = strlen($valid_chars);
266
- for ($i = 0; $i < $length; $i++)
267
- {
268
- $random_pick = mt_rand(1, $num_valid_chars);
269
- $random_char = $valid_chars[$random_pick-1];
270
- $random_string .= $random_char;
271
- }
272
- return $random_string;
273
- }
274
 
275
  ?>
10
  function s2_myajax_submit() {
11
  if ($_POST['adsoptimal_id']) update_option('readygraph_adsoptimal_id',$_POST['adsoptimal_id']);
12
  if ($_POST['adsoptimal_secret']) update_option('readygraph_adsoptimal_secret',$_POST['adsoptimal_secret']);
13
+ if (isset($_POST['readygraph_monetize'])) update_option('readygraph_enable_monetize',$_POST['readygraph_monetize']);
14
  $email = $_POST['email'];
15
  if ($email){
16
  global $wpdb;
137
 
138
  add_action('admin_notices', 'add_s2_readygraph_plugin_warning');
139
  if(get_option('readygraph_application_id') && strlen(get_option('readygraph_application_id')) > 0){
140
+ if ((get_option('readygraph_access_token') && strlen(get_option('readygraph_access_token')) > 0)){
141
  add_action('wp_footer', 's2_readygraph_client_script_head', 5);
142
  }
143
  }
241
  }
242
  }
243
  }
244
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
 
246
  ?>
subscribe2.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Subscribe2
4
  Plugin URI: http://subscribe2.wordpress.com
5
  Description: Notifies an email list when new entries are posted.
6
- Version: 10.20.4
7
  Author: Matthew Robinson, Tanay Lakhani
8
  Author URI: http://subscribe2.wordpress.com
9
  Licence: GPL3
@@ -55,7 +55,7 @@ if ( is_plugin_active_for_network(plugin_basename(__FILE__)) ) {
55
 
56
  // our version number. Don't touch this or any line below
57
  // unless you know exactly what you are doing
58
- define( 'S2VERSION', '10.20.4' );
59
  define( 'S2PATH', trailingslashit(dirname(__FILE__)) );
60
  define( 'S2DIR', trailingslashit(dirname(plugin_basename(__FILE__))) );
61
  define( 'S2URL', plugin_dir_url(dirname(__FILE__)) . S2DIR );
3
  Plugin Name: Subscribe2
4
  Plugin URI: http://subscribe2.wordpress.com
5
  Description: Notifies an email list when new entries are posted.
6
+ Version: 10.20.5
7
  Author: Matthew Robinson, Tanay Lakhani
8
  Author URI: http://subscribe2.wordpress.com
9
  Licence: GPL3
55
 
56
  // our version number. Don't touch this or any line below
57
  // unless you know exactly what you are doing
58
+ define( 'S2VERSION', '10.20.5' );
59
  define( 'S2PATH', trailingslashit(dirname(__FILE__)) );
60
  define( 'S2DIR', trailingslashit(dirname(plugin_basename(__FILE__))) );
61
  define( 'S2URL', plugin_dir_url(dirname(__FILE__)) . S2DIR );