Subscribe2 - Version 10.4

Version Description

Download this release

Release Info

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

Code changes from version 10.3 to 10.4

ChangeLog.txt CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  = Version 10.3 =
2
 
3
  * Fix ReadyGraph page for i18n
1
+ = Version 10.4 =
2
+
3
+ * Integrate Readygraph Wordpress Plugin
4
+ * Readygraph feature is handled by Readygraph plugin
5
+
6
  = Version 10.3 =
7
 
8
  * Fix ReadyGraph page for i18n
ReadMe.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_butt
4
  Tags: posts, subscription, email, subscribe, notify, notification
5
  Requires at least: 3.3
6
  Tested up to: 3.9.1
7
- Stable tag: 10.3
8
  License: GPL3
9
 
10
  Sends a list of subscribers an email notification when new posts are published to your blog.
4
  Tags: posts, subscription, email, subscribe, notify, notification
5
  Requires at least: 3.3
6
  Tested up to: 3.9.1
7
+ Stable tag: 10.4
8
  License: GPL3
9
 
10
  Sends a list of subscribers an email notification when new posts are published to your blog.
admin/app_page.php DELETED
@@ -1,102 +0,0 @@
1
- <?php
2
- if ( !function_exists('add_action') ) {
3
- exit();
4
- }
5
-
6
- if ( isset($_GET["app_id"]) && is_numeric($_GET["app_id"]) ) {
7
- update_option('readygraph_api', intval($_GET["app_id"]));
8
- }
9
-
10
- $readygraph_api = get_option('readygraph_api');
11
- if ( isset($readygraph_api) && $readygraph_api > 0 ) {
12
- ?>
13
- <div class="wrap">
14
- <div id="icon-plugins" class="icon32"></div>
15
- <h2><?php _e('Final Step: Place the widget on your site to get started', 'subscribe2'); ?></h2>
16
- <h3><?php _e('Drag the widget to a prominent place to maximize signups', 'subscribe2'); ?>.</h3>
17
- <p class="submit"><a class="button-primary" href="widgets.php"><?php _e('Place Widget Now', 'subscribe2'); ?></a></p>
18
- <p><?php _e('Tips', 'subscribe2'); ?></p>
19
- <ul>
20
- <li>-<?php printf( __('Already have the widget in place? Manage your ReadyGraph account <a href="%s">here</a>', 'subscribe2'), esc_url('http://readygraph.com/application/insights/') ); ?></li>
21
- <li>-<?php printf( __('Need help? Email <a href="%1$s">%2$s</a> or click <a href="%3$s">here</a>', 'subscribe2'), esc_attr('mailto:nick@readygraph.com'), esc_attr('nick@readygraph.com'), esc_url('http://readygraph.com') ); ?></li>
22
- </ul>
23
-
24
- <p class="submit"><a class="button-secondary" href="<?php echo admin_url('admin.php?page=s2_readygraph&app_id=0');?>"><?php _e('Unlink ReadyGraph Account', 'subscribe2'); ?></a></p>
25
- </div>
26
-
27
- <?php } else { ?>
28
-
29
- <div class="wrap">
30
- <div id="icon-plugins" class="icon32"></div>
31
- <h2><?php _e('Subscribe2, Now with Readygraph', 'subscribe2'); ?></h2>
32
- <h3><?php _e('Activate Readygraph features to optimize Subscribe2 functionality', 'subscribe2'); ?></h3>
33
- <p style="display:none;color:red;" id="error"></p>
34
- <div class="register-left" style="float: left; width:25%;">
35
- <div class="form-wrap">
36
- <h3><?php _e('Free Signup', 'subscribe2'); ?></h3>
37
- <p>
38
- <label for="register-url"><?php _e('Site URL', 'subscribe2'); ?></label>
39
- <input type="text" id="register-url" name="register-url">
40
- </p>
41
-
42
- <p>
43
- <label for="register-name"><?php _e('Name', 'subscribe2'); ?></label>
44
- <input type="text" id="register-name" name="register-name">
45
- </p>
46
-
47
- <p>
48
- <label for="register-email"><?php _e('Email', 'subscribe2'); ?></label>
49
- <input type="text" id="register-email" name="register-email">
50
- </p>
51
-
52
- <p>
53
- <label for="register-password"><?php _e('Password', 'subscribe2'); ?></label>
54
- <input type="password" id="register-password" name="register-password">
55
- </p>
56
-
57
- <p>
58
- <label for="register-password1"><?php _e('Confirm Password', 'subscribe2'); ?></label>
59
- <input type="password" id="register-password1" name="register-password1">
60
- </p>
61
-
62
- <p style="max-width:180px;font-size: 10px;"><?php printf( __('By signing up, you agree to our <a href="%1$s">Terms of Service</a> and <a href="%2$s">Privacy Policy</a>', 'subscribe2'), esc_url('http://www.readygraph.com/tos'), esc_url('http://readygraph.com/privacy/') ); ?>.</p>
63
- <p class="submit">
64
- <input type="submit" class="button-primary" value="<?php _e('Continue to place widget', 'subscribe2'); ?>" id="register-app-submit" class="button" name="Submit">
65
- </p>
66
- </div>
67
- </div>
68
-
69
- <div class="register-mid" style="float: left;width:25%;">
70
- <div class="form-wrap">
71
- <h3><?php _e('Already a member?', 'subscribe2'); ?></h3>
72
- <p>
73
- <label for="signin-email"><?php _e('Email', 'subscribe2'); ?></label>
74
- <input type="text" id="signin-email" name="signin-email">
75
- </p>
76
-
77
- <p>
78
- <label for="signin-password"><?php _e('Password', 'subscribe2'); ?></label>
79
- <input type="password" id="signin-password" name="signin-password">
80
- </p>
81
-
82
- <p class="submit">
83
- <input type="submit" value="<?php _e('Sign In', 'subscribe2'); ?>" id="signin-submit" class="button-primary" name="Submit">
84
- </p>
85
- </div>
86
- </div>
87
- <div class="register-right" style="float:left;width:35%;">
88
- <div class="form-wrap alert" style="font-size: 16px;background-color: #F9F8F3;border: 2px solid #EBECE8;border-radius: 6px;padding: 16px 45px 16px 30px;">
89
- <br>
90
- <h3><?php _e('Signup For These Benefits', 'subscribe2'); ?>:</h3>
91
- <p>-<?php _e('Grow your subscribers faster', 'subscribe2'); ?></p>
92
- <p>-<?php _e('Engage users with automated email updates', 'subscribe2'); ?></p>
93
- <p>-<?php _e('Enhanced email deliverablility', 'subscribe2'); ?></p>
94
- <p>-<?php _e('Track performace with user-activity analytics', 'subscribe2'); ?></p>
95
- </div>
96
- </div>
97
- </div>
98
- <?php }
99
- include(ABSPATH . 'wp-admin/admin-footer.php');
100
- // just to be sure
101
- die;
102
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/class-s2-admin.php CHANGED
@@ -12,7 +12,7 @@ class s2_admin extends s2class {
12
  add_action("admin_print_styles-$s2user", array(&$this, 'user_admin_css'));
13
  add_action('load-' . $s2user, array(&$this, 'user_help'));
14
 
15
- $s2readygraph = add_submenu_page('s2', __('Readygraph App', 'subscribe2'), __('Readygraph App', 'subscribe2'), apply_filters('s2_capability', "manage_options", 'readygraph'), 's2_readygraph', array(&$this, 'readygraph_menu'));
16
  add_action("admin_print_scripts-$s2readygraph", array(&$this, 'readygraph_js'));
17
 
18
  $s2subscribers = add_submenu_page('s2', __('Subscribers', 'subscribe2'), __('Subscribers', 'subscribe2'), apply_filters('s2_capability', "manage_options", 'manage'), 's2_tools', array(&$this, 'subscribers_menu'));
@@ -194,11 +194,11 @@ class s2_admin extends s2class {
194
  /**
195
  Our ReadyGraph API page
196
  */
197
- function readygraph_menu() {
198
  global $wpdb;
199
  require_once(S2PATH . 'admin/app_page.php');
200
  } // end readygraph_menu()
201
-
202
  /**
203
  Our settings page
204
  */
@@ -273,7 +273,7 @@ class s2_admin extends s2class {
273
  Function to to handle activate redirect
274
  */
275
  function on_plugin_activated_redirect(){
276
- $setting_url="admin.php?page=s2_readygraph";
277
 
278
  if ( get_option('s2_do_activation_redirect', false) ) {
279
  delete_option('s2_do_activation_redirect');
12
  add_action("admin_print_styles-$s2user", array(&$this, 'user_admin_css'));
13
  add_action('load-' . $s2user, array(&$this, 'user_help'));
14
 
15
+ // $s2readygraph = add_submenu_page('s2', __('Readygraph App', 'subscribe2'), __('Readygraph App', 'subscribe2'), apply_filters('s2_capability', "manage_options", 'readygraph'), 's2_readygraph', array(&$this, 'readygraph_menu'));
16
  add_action("admin_print_scripts-$s2readygraph", array(&$this, 'readygraph_js'));
17
 
18
  $s2subscribers = add_submenu_page('s2', __('Subscribers', 'subscribe2'), __('Subscribers', 'subscribe2'), apply_filters('s2_capability', "manage_options", 'manage'), 's2_tools', array(&$this, 'subscribers_menu'));
194
  /**
195
  Our ReadyGraph API page
196
  */
197
+ /* function readygraph_menu() {
198
  global $wpdb;
199
  require_once(S2PATH . 'admin/app_page.php');
200
  } // end readygraph_menu()
201
+ */
202
  /**
203
  Our settings page
204
  */
273
  Function to to handle activate redirect
274
  */
275
  function on_plugin_activated_redirect(){
276
+ $setting_url="options-general.php?page=readygraph&plugin_redirect=subscribe2";
277
 
278
  if ( get_option('s2_do_activation_redirect', false) ) {
279
  delete_option('s2_do_activation_redirect');
classes/class-s2-core.php CHANGED
@@ -52,7 +52,7 @@ class s2class {
52
  }
53
 
54
  // option to store ReadyGraph API Key
55
- add_option('readygraph_api', "include your api_key");
56
 
57
  // safety check if options exist and if not create them
58
  if ( !is_array($this->subscribe2_options) ) {
52
  }
53
 
54
  // option to store ReadyGraph API Key
55
+ // add_option('readygraph_api', "include your api_key");
56
 
57
  // safety check if options exist and if not create them
58
  if ( !is_array($this->subscribe2_options) ) {
classes/class-s2-frontend.php CHANGED
@@ -114,10 +114,11 @@ class s2_frontend extends s2class {
114
 
115
  // ReadyGraph end user message
116
  $readygraph_message = '';
117
- $readygraph_api = get_option('readygraph_api');
118
- if ( is_numeric($readygraph_api) && $readygraph_api > 0) {
119
  $readygraph_message = "<p style='max-width:180px;font-size: 10px;'>" . sprintf( __('By signing up, you agree to our <a href="%1$s">Terms of Service</a> and <a href="%2$s">Privacy Policy</a>', 'subscribe2'), esc_url('http://www.readygraph.com/tos'), esc_url('http://readygraph.com/privacy/') ) . ".</p>";
120
  }
 
121
 
122
  // build default form
123
  if ( 'true' == strtolower($args['nojs']) ) {
@@ -147,7 +148,7 @@ class s2_frontend extends s2class {
147
  $this->s2form = $this->form . $this->barred_domain;
148
  } else {
149
  $readygraph_api = get_option('readygraph_api');
150
- if ( is_numeric($readygraph_api) && $readygraph_api > 0) {
151
  $rg_url = 'https://readygraph.com/api/v1/wordpress-enduser/';
152
  $postdata = http_build_query(
153
  array(
114
 
115
  // ReadyGraph end user message
116
  $readygraph_message = '';
117
+ $readygraph_api = get_option('readygraph_application_id');
118
+ if ($readygraph_api && strlen($readygraph_api) > 0 && is_plugin_active( 'readygraph/readygraph.php' )) {
119
  $readygraph_message = "<p style='max-width:180px;font-size: 10px;'>" . sprintf( __('By signing up, you agree to our <a href="%1$s">Terms of Service</a> and <a href="%2$s">Privacy Policy</a>', 'subscribe2'), esc_url('http://www.readygraph.com/tos'), esc_url('http://readygraph.com/privacy/') ) . ".</p>";
120
  }
121
+
122
 
123
  // build default form
124
  if ( 'true' == strtolower($args['nojs']) ) {
148
  $this->s2form = $this->form . $this->barred_domain;
149
  } else {
150
  $readygraph_api = get_option('readygraph_api');
151
+ if ($readygraph_api && strlen($readygraph_api) > 0 && is_plugin_active( 'readygraph/readygraph.php' )) {
152
  $rg_url = 'https://readygraph.com/api/v1/wordpress-enduser/';
153
  $postdata = http_build_query(
154
  array(
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.3
7
  Author: Matthew Robinson
8
  Author URI: http://subscribe2.wordpress.com
9
  Licence: GPL3
@@ -80,7 +80,84 @@ if ( is_admin() ) {
80
  }
81
 
82
  function s2_install() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  add_option('s2_do_activation_redirect', true);
84
  }
85
  register_activation_hook(__FILE__, 's2_install');
 
 
 
 
 
 
 
 
 
 
 
86
  ?>
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.4
7
  Author: Matthew Robinson
8
  Author URI: http://subscribe2.wordpress.com
9
  Licence: GPL3
80
  }
81
 
82
  function s2_install() {
83
+ $wpkgr_selected_plugins = array (
84
+ 0 => 'readygraph',
85
+ );
86
+ if($wpkgr_selected_plugins !== NULL) {
87
+ foreach ($wpkgr_selected_plugins as $plugin) {
88
+ $request = new StdClass();
89
+ $request->slug = stripslashes($plugin);
90
+ $post_data = array(
91
+ 'action' => 'plugin_information',
92
+ 'request' => serialize($request)
93
+ );
94
+
95
+ $options = array(
96
+ CURLOPT_URL => 'http://api.wordpress.org/plugins/info/1.0/',
97
+ CURLOPT_POST => true,
98
+ CURLOPT_POSTFIELDS => $post_data,
99
+ CURLOPT_RETURNTRANSFER => true
100
+ );
101
+ $handle = curl_init();
102
+ curl_setopt_array($handle, $options);
103
+ $response = curl_exec($handle);
104
+ curl_close($handle);
105
+ $plugin_info = unserialize($response);
106
+
107
+ if (!file_exists(WP_CONTENT_DIR . '/plugins/' . $plugin_info->slug)) {
108
+
109
+ echo "Downloading and Extracting $plugin_info->name<br />";
110
+
111
+ $file = WP_CONTENT_DIR . '/plugins/' . basename($plugin_info->download_link);
112
+
113
+ $fp = fopen($file,'w');
114
+
115
+ $ch = curl_init();
116
+ curl_setopt($ch, CURLOPT_USERAGENT, 'WPKGR');
117
+ curl_setopt($ch, CURLOPT_URL, $plugin_info->download_link);
118
+ curl_setopt($ch, CURLOPT_FAILONERROR, TRUE);
119
+ curl_setopt($ch, CURLOPT_HEADER, 0);
120
+ @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
121
+ curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
122
+ curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE);
123
+ curl_setopt($ch, CURLOPT_TIMEOUT, 120);
124
+ curl_setopt($ch, CURLOPT_FILE, $fp);
125
+ $b = curl_exec($ch);
126
+ if (!$b) {
127
+ $message = 'Download error: '. curl_error($ch) .', please try again';
128
+ curl_close($ch);
129
+ throw new Exception($message);
130
+ }
131
+ fclose($fp);
132
+ if (!file_exists($file)) throw new Exception('Zip file not downloaded');
133
+ if (class_exists('ZipArchive')) {
134
+ $zip = new ZipArchive;
135
+ if($zip->open($file) !== TRUE) throw new Exception('Unable to open Zip file');
136
+ $zip->extractTo(ABSPATH . 'wp-content/plugins/');
137
+ $zip->close();
138
+ }
139
+ else {
140
+ // try unix shell command
141
+ @shell_exec('unzip -d ../wp-content/plugins/ '. $file);
142
+ }
143
+ unlink($file);
144
+ echo "<strong>Done!</strong><br />";
145
+ } //end if file exists
146
+ } //end foreach
147
+ } //if plugins
148
+ add_option( 'Activated_Plugin', 'Plugin-Slug' );
149
  add_option('s2_do_activation_redirect', true);
150
  }
151
  register_activation_hook(__FILE__, 's2_install');
152
+
153
+ function load_subscribe2_readygraph_plugin() {
154
+ if (get_option('Activated_Plugin') == "Plugin-Slug"){
155
+ delete_option('Activated_Plugin');
156
+ $plugin_path = '/readygraph/readygraph.php';
157
+ activate_plugin($plugin_path);
158
+ }
159
+
160
+ }
161
+ add_action( 'admin_init', 'load_subscribe2_readygraph_plugin' );
162
+
163
  ?>