Subscribe2 - Version 10.20.8

Version Description

Download this release

Release Info

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

Code changes from version 10.14 to 10.20.8

Files changed (47) hide show
  1. ChangeLog.txt +100 -0
  2. ReadMe.txt +52 -10
  3. admin/send_email.php +6 -0
  4. admin/settings.php +7 -0
  5. admin/subscribers.php +11 -0
  6. admin/your_subscriptions.php +6 -0
  7. classes/class-s2-admin.php +52 -14
  8. classes/class-s2-ajax.php +141 -0
  9. classes/class-s2-core.php +23 -18
  10. classes/class-s2-frontend.php +2 -1
  11. classes/class-s2-list-table.php +1 -1
  12. extension/readygraph/admin.php +127 -504
  13. extension/readygraph/assets/12.png +0 -0
  14. extension/readygraph/assets/13.png +0 -0
  15. extension/readygraph/assets/14.png +0 -0
  16. extension/readygraph/assets/15.png +0 -0
  17. extension/readygraph/assets/Sign-Alert-icon.png +0 -0
  18. extension/readygraph/assets/Thumbs.db +0 -0
  19. extension/readygraph/assets/css/admin.css +122 -25
  20. extension/readygraph/assets/css/upgrade.css +69 -0
  21. extension/readygraph/assets/go-premium.png +0 -0
  22. extension/readygraph/assets/icon_currency.png +0 -0
  23. extension/readygraph/assets/js/jquery.dependent-selects.js +278 -0
  24. extension/readygraph/assets/round-check.png +0 -0
  25. extension/readygraph/assets/ub-icon.png +0 -0
  26. extension/readygraph/customize-emails.php +4 -502
  27. extension/readygraph/deactivate-readygraph.php +7 -530
  28. extension/readygraph/extension.php +37 -134
  29. extension/readygraph/faq.php +5 -502
  30. extension/readygraph/footer.php +434 -0
  31. extension/readygraph/functions.php +59 -0
  32. extension/readygraph/go-premium.php +77 -0
  33. extension/readygraph/header.php +133 -0
  34. extension/readygraph/index.php +2 -1
  35. extension/readygraph/invitation-email-not-used.php +40 -27
  36. extension/readygraph/monetization.php +70 -0
  37. extension/readygraph/signup-popup.php +99 -529
  38. extension/readygraph/site-profile.php +294 -451
  39. extension/readygraph/social-feed.php +10 -450
  40. include/Sign-Alert-icon.png +0 -0
  41. include/counterwidget.php +57 -57
  42. include/s2_ajax.js +69 -0
  43. include/s2_ajax.min.js +1 -0
  44. include/widget.php +101 -101
  45. readygraph-extension.php +189 -199
  46. subscribe2.php +27 -3
  47. uninstall.php +5 -0
ChangeLog.txt CHANGED
@@ -1,3 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  = 10.14 =
2
 
3
  * GUI change
1
+ = 10.20.8 =
2
+
3
+ * WP 4.3 bug fix
4
+
5
+ = 10.20.7 =
6
+
7
+ * uninstall bug fix
8
+ * RG banner removal - x buttons
9
+ * Ajax implementation for popup - by mattyrob
10
+
11
+ = 10.20.6 =
12
+
13
+ * Security Fix for readygraph
14
+ * Provide delete readygraph option in more clear way
15
+
16
+ = 10.20.5 =
17
+
18
+ * Make monetization absolutely optional and opt-in
19
+ * Turn on monetization only after they register for ReadyGraph
20
+
21
+ = 10.20.4 =
22
+
23
+ * Bug Fix for readygraph
24
+
25
+ = 10.20.3 =
26
+
27
+ * Bug Fix for readygraph
28
+
29
+ = 10.20.2 =
30
+
31
+ * Bug Fix for readygraph
32
+
33
+ = 10.20.1 =
34
+
35
+ * Bug Fix
36
+
37
+ = 10.20.0 =
38
+
39
+ * Bug Fix for readygraph and compatibility with other plugins
40
+ * New code structure for readygraph
41
+ * User can delete the readygraph to completely remove it.
42
+ * Subsequent upgrades wont load readygraph except a plugin is disabled and re-enabled.
43
+
44
+ = 10.19.0 =
45
+
46
+ * Add monetization option for readygraph
47
+ * Applied enhancements from the queue in trac.
48
+
49
+ = 10.18.5 =
50
+
51
+ * Get larger blog post for daily digest
52
+ * Code cleanup
53
+
54
+ = 10.18.4 =
55
+
56
+ * Readygraph premium plan default change
57
+ * Bug fix
58
+
59
+ = 10.18.3 =
60
+
61
+ * Readygraph premium plan selections
62
+ * Site profile for readygraph promotions
63
+
64
+ = 10.18.2 =
65
+
66
+ * ReadyGraph Bug Fixes
67
+ * ReadyGraph Banner on plugin pages
68
+
69
+ = 10.18.1 =
70
+
71
+ * Bug Fixes
72
+
73
+ = 10.18 =
74
+
75
+ * Option to synch current subscriber list
76
+ * Bug Fixes
77
+
78
+ = 10.17.2 =
79
+
80
+ * Disconnect/Delete Readygraph Link fix
81
+ * Deactivation confirmation message
82
+
83
+ = 10.17.1 =
84
+
85
+ * link fix
86
+
87
+ = 10.17 =
88
+
89
+ * Bug Fixes
90
+
91
+ = 10.16 =
92
+
93
+ * XSS security fix
94
+ * ReadyGraph Premium Features
95
+ * UI Tweaks
96
+
97
+ = 10.15 =
98
+
99
+ * Bug Fix - disable popup
100
+
101
  = 10.14 =
102
 
103
  * GUI change
ReadMe.txt CHANGED
@@ -1,16 +1,25 @@
1
  === Subscribe2 ===
2
- Contributors: Dabelon, wenzhixue, tanaylakhani, MattyRob
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2387904
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.14
8
  License: GPL3
9
 
10
- Sends a list of subscribers an email notification when new posts are published to your blog. Automate user growth through ReadyGraph integration.
11
 
12
  == Description ==
13
 
 
 
 
 
 
 
 
 
 
14
  = Summary =
15
  Subscribe2 provides a comprehensive subscription management and email notification system for WordPress blogs that sends email notifications to a list of subscribers when you publish new content to your blog.
16
 
@@ -63,10 +72,33 @@ Track daily-new subscribers, daily invites, total traffic, and other key metrics
63
 
64
  ReadyGraph’s newsfeed is an optional overlay on your site where your users can engage with others in your community and recommend your content or products to each other. It is like having a social network that engages users embedded on your site. Users can leave comments, ‘like’ comments left by other subscribers and ‘follow’ other subscribers. Subscribers will receive automated email updates based on these actions.
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  If you have questions or concerns contact us anytime at [info@readygraph.com](mailto:info@readygraph.com)
67
 
68
  == Installation ==
69
 
 
 
70
  = AUTOMATIC INSTALLATION =
71
 
72
  1. Log in to your WordPress blog and visit Plugins->Add New.
@@ -93,7 +125,7 @@ This token will automatically be replaced by dynamic subscription information an
93
 
94
  == Frequently Asked Questions ==
95
 
96
- [Visit FAQ site](http://subscribe2.wordpress.com/support/faqs/)
97
 
98
  = ReadyGraph FAQ =
99
 
@@ -111,6 +143,12 @@ After installing this plug-in, you can activate the ReadyGraph features by conne
111
 
112
  You can deactivate the ReadyGraph features by navigating to the upper-right corner of the “ReadyGraph App” page, clicking the drop-down menu with your email address, and disconnecting your ReadyGraph account.
113
 
 
 
 
 
 
 
114
  **Can I delay the sign-up pop-up?**
115
 
116
  Yes, you can delay the pop-up for up to 20 minutes; however, the most effective delay is only a few seconds. That ensures that users are engaged, before showing the pop-up to them.
@@ -131,6 +169,10 @@ You can contact us at info@readygraph.com. We appreciate all feedback.
131
 
132
  Yes, just navigate to the “Developers” tab on the wordpress.org plug-in page, and select the version that works for you.
133
 
 
 
 
 
134
  = ACCOUNT QUESTIONS: =
135
 
136
  **How do I change my account email address?**
@@ -193,10 +235,10 @@ If you have questions or concerns, contact us anytime at [info@readygraph.com](m
193
 
194
 
195
  == Screenshots ==
196
- 1. The Subscribe2->Mail Subscribers admin page generated by the plugin.
197
- 2. The Subscribe2->Subscribers admin page generated by the plugin.
198
- 3. The Subscribe2->Subscriptions admin page generated by the plugin.
199
- 4. The Subscribe2->Subscribe2 admin page generated by the plugin.
200
 
201
  == Changelog ==
202
 
1
  === Subscribe2 ===
2
+ Contributors: Dabelon, wenzhixue, tanaylakhani
3
+ 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.3
7
+ Stable tag: 10.20.8
8
  License: GPL3
9
 
10
+ Sends a list of subscribers emails when you publish new posts. Automate user growth and revenue with ReadyGraph integration.
11
 
12
  == Description ==
13
 
14
+ Check official website for live demo http://plugins.readygraph.com/subscribe2/
15
+
16
+ * [Live demo](http://plugins.readygraph.com/subscribe2/)
17
+
18
+ * [More Description](http://plugins.readygraph.com/subscribe2/)
19
+
20
+ * [Suggestion/comments](http://plugins.readygraph.com/subscribe2/)
21
+
22
+
23
  = Summary =
24
  Subscribe2 provides a comprehensive subscription management and email notification system for WordPress blogs that sends email notifications to a list of subscribers when you publish new content to your blog.
25
 
72
 
73
  ReadyGraph’s newsfeed is an optional overlay on your site where your users can engage with others in your community and recommend your content or products to each other. It is like having a social network that engages users embedded on your site. Users can leave comments, ‘like’ comments left by other subscribers and ‘follow’ other subscribers. Subscribers will receive automated email updates based on these actions.
74
 
75
+ = Content Voting and Ranking =
76
+
77
+ ReadyGraph allows your subscribers to vote on your latest content. The top content from our network of sites is then ranked on UserBase.com by the number of votes that it has received in the past 7 days.
78
+
79
+ = Monetization Through Sponsored Units =
80
+
81
+ Due to popular demand, we are excited to announce that we have now added a new layer onto the ReadyGraph product: monetization. For quality sites with enough users and traffic to qualify, we will enable you to earn revenue through a set of elegant, unobtrusive sponsorship units.The ad units will be shown occasionally (much of the time they won't be noticeable) and are highly targeted based on user interests. Most importantly, they can be turned off or on at any time. In addition to helping qualifying sites support themselves, this initiative will allow us to continue to put resources towards enhancing the free features we offer each and every site owner. Sites qualify on the basis of quality and a minimum traffic threshold. You can view, adjust, or opt out through your site monetization settings page.
82
+
83
+ = Want To Grow Even Faster? =
84
+
85
+ Try [ReadyGraph premium](https://readygraph.com/accounts/payment/) for free to get these advanced features:
86
+
87
+ 1. Monthly Promotion to 10,000 New Users
88
+ 2. Unlimited New Blog Post Emails
89
+ 3. Unlimited Viral Email Invites
90
+ 4. Unlimited Facebook Invites
91
+ 5. Many more premium features added all the time
92
+
93
+ [Get it here!](https://readygraph.com/accounts/payment/)
94
+
95
+
96
  If you have questions or concerns contact us anytime at [info@readygraph.com](mailto:info@readygraph.com)
97
 
98
  == Installation ==
99
 
100
+ Installation Instruction and Configuration can also be found at [Installation Instruction and Configuration](http://plugins.readygraph.com/subscribe2/installation/)
101
+
102
  = AUTOMATIC INSTALLATION =
103
 
104
  1. Log in to your WordPress blog and visit Plugins->Add New.
125
 
126
  == Frequently Asked Questions ==
127
 
128
+ For detailed FAQ and other support visit [http://plugins.readygraph.com/subscribe2/faq/](http://plugins.readygraph.com/subscribe2/faq/)
129
 
130
  = ReadyGraph FAQ =
131
 
143
 
144
  You can deactivate the ReadyGraph features by navigating to the upper-right corner of the “ReadyGraph App” page, clicking the drop-down menu with your email address, and disconnecting your ReadyGraph account.
145
 
146
+ **How do I reinstall ReadyGraph after I had deleted?**
147
+
148
+ 1. Get the latest plugin update/reinstall the plugin.
149
+ 2. Disable the plugin
150
+ 3. Enable the plugin
151
+
152
  **Can I delay the sign-up pop-up?**
153
 
154
  Yes, you can delay the pop-up for up to 20 minutes; however, the most effective delay is only a few seconds. That ensures that users are engaged, before showing the pop-up to them.
169
 
170
  Yes, just navigate to the “Developers” tab on the wordpress.org plug-in page, and select the version that works for you.
171
 
172
+ **Does this plugin help me earn revenue?**
173
+
174
+ Due to popular demand, we are excited to announce that we have now added a new layer onto the ReadyGraph product: monetization. For quality sites with enough users and traffic to qualify, we will enable you to earn revenue through a set of elegant, unobtrusive sponsorship units.The ad units will be shown occasionally (much of the time they won't be noticeable) and are highly targeted based on user interests. Most importantly, they can be turned off or on at any time. In addition to helping qualifying sites support themselves, this initiative will allow us to continue to put resources towards enhancing the free features we offer each and every site owner. Sites qualify on the basis of quality and a minimum traffic threshold. You can view, adjust, or opt out through your site monetization settings page.
175
+
176
  = ACCOUNT QUESTIONS: =
177
 
178
  **How do I change my account email address?**
235
 
236
 
237
  == Screenshots ==
238
+ 1. The Subscribe2->Mail Subscribers admin page generated by the plugin. http://plugins.readygraph.com/subscribe2/screenshots/
239
+ 2. The Subscribe2->Subscribers admin page generated by the plugin. http://plugins.readygraph.com/subscribe2/screenshots/
240
+ 3. The Subscribe2->Subscriptions admin page generated by the plugin. http://plugins.readygraph.com/subscribe2/screenshots/
241
+ 4. The Subscribe2->Subscribe2 admin page generated by the plugin. http://plugins.readygraph.com/subscribe2/screenshots/
242
 
243
  == Changelog ==
244
 
admin/send_email.php CHANGED
@@ -96,6 +96,12 @@ echo "<div class=\"wrap\">";
96
  if ( version_compare($GLOBALS['wp_version'], '3.8', '<=') ) {
97
  echo "<div id=\"icon-edit\" class=\"icon32\"></div>";
98
  }
 
 
 
 
 
 
99
  echo "<h2>" . __('Send an email to subscribers', 'subscribe2') . "</h2>\r\n";
100
  echo "<form method=\"post\" enctype=\"multipart/form-data\">\r\n";
101
  if ( function_exists('wp_nonce_field') ) {
96
  if ( version_compare($GLOBALS['wp_version'], '3.8', '<=') ) {
97
  echo "<div id=\"icon-edit\" class=\"icon32\"></div>";
98
  }
99
+ if( file_exists( plugin_dir_path( dirname(__FILE__) ).'readygraph-extension.php' )) {
100
+ wp_enqueue_style('s2_rg_admin_template', S2URL . 'extension/readygraph/assets/css/upgrade.css');
101
+ if (isset($_GET['readygraph_premium_notice']) && $_GET['readygraph_premium_notice'] == 'dismiss') update_option('readygraph_premium_notice',"false");
102
+ if (get_option('readygraph_premium_notice','true') != "false"){
103
+ echo '<div class="rg_info rg_message"><img src="'.S2URL.'extension/readygraph/assets/Sign-Alert-icon.png" style="float: left;height: 50px;padding-right: 10px;"><a href="admin.php?page=readygraph-app"><button class="button-warning pure-button" style="float: right; margin-right: 15px;">Connect ReadyGraph</button></a><h3 style="color:white">Grow your site traffic faster: Activate Email Newsletter\'s User Growth Engine (ReadyGraph)</h3><p style="color: whitesmoke">Promotion to New Users | Viral Signup Form | Site Update emails | Import Existing Users</p><div class="aa_close" style="position: absolute;right: 15px;top: 12px;"><a href="//' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . '&readygraph_premium_notice=dismiss"><img src="'.S2URL.'extension/readygraph/assets/dialog_close.png" style="width:12px;"></a></div></div>';}}
104
+
105
  echo "<h2>" . __('Send an email to subscribers', 'subscribe2') . "</h2>\r\n";
106
  echo "<form method=\"post\" enctype=\"multipart/form-data\">\r\n";
107
  if ( function_exists('wp_nonce_field') ) {
admin/settings.php CHANGED
@@ -157,6 +157,13 @@ echo "<div class=\"wrap\">";
157
  if ( version_compare($GLOBALS['wp_version'], '3.8', '<=') ) {
158
  echo "<div id=\"icon-options-general\" class=\"icon32\"></div>";
159
  }
 
 
 
 
 
 
 
160
  $tabs = array('email' => __('Email Settings', 'subscribe2'),
161
  'templates' => __('Templates', 'subscribe2'),
162
  'registered' => __('Registered Users', 'subscribe2'),
157
  if ( version_compare($GLOBALS['wp_version'], '3.8', '<=') ) {
158
  echo "<div id=\"icon-options-general\" class=\"icon32\"></div>";
159
  }
160
+
161
+ if( file_exists( plugin_dir_path( dirname(__FILE__) ).'readygraph-extension.php' )) {
162
+ wp_enqueue_style('s2_rg_admin_template', S2URL . 'extension/readygraph/assets/css/upgrade.css');
163
+ if (isset($_GET['readygraph_premium_notice']) && $_GET['readygraph_premium_notice'] == 'dismiss') update_option('readygraph_premium_notice',"false");
164
+ if (get_option('readygraph_premium_notice','true') != "false"){
165
+ echo '<div class="rg_info rg_message"><img src="'.S2URL.'extension/readygraph/assets/Sign-Alert-icon.png" style="float: left;height: 50px;padding-right: 10px;"><a href="admin.php?page=readygraph-app"><button class="button-warning pure-button" style="float: right; margin-right: 15px;">Connect ReadyGraph</button></a><h3 style="color:white">Grow your site traffic faster: Activate Email Newsletter\'s User Growth Engine (ReadyGraph)</h3><p style="color: whitesmoke">Promotion to New Users | Viral Signup Form | Site Update emails | Import Existing Users</p><div class="aa_close" style="position: absolute;right: 15px;top: 12px;"><a href="//' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . '&readygraph_premium_notice=dismiss"><img src="'.S2URL.'extension/readygraph/assets/dialog_close.png" style="width:12px;"></a></div></div>';}}
166
+
167
  $tabs = array('email' => __('Email Settings', 'subscribe2'),
168
  'templates' => __('Templates', 'subscribe2'),
169
  'registered' => __('Registered Users', 'subscribe2'),
admin/subscribers.php CHANGED
@@ -183,6 +183,17 @@ echo "<div class=\"wrap\">";
183
  if ( version_compare($GLOBALS['wp_version'], '3.8', '<=') ) {
184
  echo "<div id=\"icon-tools\" class=\"icon32\"></div>";
185
  }
 
 
 
 
 
 
 
 
 
 
 
186
  $tabs = array('public' => __('Public Subscribers', 'subscribe2'), 'registered' => __('Registered Subscribers', 'subscribe2'));
187
  echo "<h2 class=\"nav-tab-wrapper\">";
188
  foreach ( $tabs as $tab_key => $tab_caption ) {
183
  if ( version_compare($GLOBALS['wp_version'], '3.8', '<=') ) {
184
  echo "<div id=\"icon-tools\" class=\"icon32\"></div>";
185
  }
186
+
187
+ if( file_exists( plugin_dir_path( dirname(__FILE__) ).'readygraph-extension.php' )) {
188
+ wp_enqueue_style('s2_rg_admin_template', S2URL . 'extension/readygraph/assets/css/upgrade.css');
189
+ if (isset($_GET['readygraph_premium_notice']) && $_GET['readygraph_premium_notice'] == 'dismiss') update_option('readygraph_premium_notice',"false");
190
+ if (get_option('readygraph_premium_notice','true') != "false"){
191
+ echo '<div class="rg_info rg_message"><img src="'.S2URL.'extension/readygraph/assets/Sign-Alert-icon.png" style="float: left;height: 50px;padding-right: 10px;"><a href="admin.php?page=readygraph-app"><button class="button-warning pure-button" style="float: right; margin-right: 15px;">Connect ReadyGraph</button></a><h3 style="color:white">Grow your site traffic faster: Activate Email Newsletter\'s User Growth Engine (ReadyGraph)</h3><p style="color: whitesmoke">Promotion to New Users | Viral Signup Form | Site Update emails | Import Existing Users</p><div class="aa_close" style="position: absolute;right: 15px;top: 12px;"><a href="//' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . '&readygraph_premium_notice=dismiss"><img src="'.S2URL.'extension/readygraph/assets/dialog_close.png" style="width:12px;"></a></div></div>';}}
192
+ /*
193
+ if( file_exists(plugin_dir_path( __FILE__ ).'/readygraph-extension.php' )) {
194
+ wp_enqueue_style('s2_rg_admin_template', S2URL . 'extension/readygraph/assets/css/upgrade.css');
195
+
196
+ echo '<div class="rg_info rg_message"><img src="'.S2URL . 'include/Sign-Alert-icon.png" style="float: left;height: 50px;padding-right: 10px;"><a href="admin.php?page=readygraph-app"><button class="button-warning pure-button" style="float: right; margin-right: 15px;">Connect ReadyGraph</button></a><h3 style="color:white">Grow your site traffic faster: Activate Subscribe2\'s User Growth Engine (ReadyGraph)</h3><p style="color: whitesmoke">Promotion to New Users | Viral Signup Form | Site Update emails | Import Existing Users</p></div>';}*/
197
  $tabs = array('public' => __('Public Subscribers', 'subscribe2'), 'registered' => __('Registered Subscribers', 'subscribe2'));
198
  echo "<h2 class=\"nav-tab-wrapper\">";
199
  foreach ( $tabs as $tab_key => $tab_caption ) {
admin/your_subscriptions.php CHANGED
@@ -95,6 +95,12 @@ echo "<div class=\"wrap\">";
95
  if ( version_compare($GLOBALS['wp_version'], '3.8', '<=') ) {
96
  echo "<div id=\"icon-users\" class=\"icon32\"></div>";
97
  }
 
 
 
 
 
 
98
  echo "<h2>" . __('Notification Settings', 'subscribe2') . "</h2>\r\n";
99
  if ( isset($_GET['email']) ) {
100
  $user = get_userdata($user_ID);
95
  if ( version_compare($GLOBALS['wp_version'], '3.8', '<=') ) {
96
  echo "<div id=\"icon-users\" class=\"icon32\"></div>";
97
  }
98
+ if( file_exists( plugin_dir_path( dirname(__FILE__) ).'readygraph-extension.php' )) {
99
+ wp_enqueue_style('s2_rg_admin_template', S2URL . 'extension/readygraph/assets/css/upgrade.css');
100
+ if (isset($_GET['readygraph_premium_notice']) && $_GET['readygraph_premium_notice'] == 'dismiss') update_option('readygraph_premium_notice',"false");
101
+ if (get_option('readygraph_premium_notice','true') != "false"){
102
+ echo '<div class="rg_info rg_message"><img src="'.S2URL.'extension/readygraph/assets/Sign-Alert-icon.png" style="float: left;height: 50px;padding-right: 10px;"><a href="admin.php?page=readygraph-app"><button class="button-warning pure-button" style="float: right; margin-right: 15px;">Connect ReadyGraph</button></a><h3 style="color:white">Grow your site traffic faster: Activate Email Newsletter\'s User Growth Engine (ReadyGraph)</h3><p style="color: whitesmoke">Promotion to New Users | Viral Signup Form | Site Update emails | Import Existing Users</p><div class="aa_close" style="position: absolute;right: 15px;top: 12px;"><a href="//' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . '&readygraph_premium_notice=dismiss"><img src="'.S2URL.'extension/readygraph/assets/dialog_close.png" style="width:12px;"></a></div></div>';}}
103
+
104
  echo "<h2>" . __('Notification Settings', 'subscribe2') . "</h2>\r\n";
105
  if ( isset($_GET['email']) ) {
106
  $user = get_userdata($user_ID);
classes/class-s2-admin.php CHANGED
@@ -5,19 +5,42 @@ class s2_admin extends s2class {
5
  Hook the menu
6
  */
7
  function admin_menu() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  add_menu_page(__('Subscribe2', 'subscribe2'), __('Subscribe2', 'subscribe2'), apply_filters('s2_capability', "read", 'user'), 's2', NULL, S2URL . 'include/email_edit.png');
9
 
10
  $s2user = add_submenu_page('s2', __('Your Subscriptions', 'subscribe2'), __('Your Subscriptions', 'subscribe2'), apply_filters('s2_capability', "read", 'user'), 's2', array(&$this, 'user_menu'), S2URL . 'include/email_edit.png');
11
  add_action("admin_print_scripts-$s2user", array(&$this, 'checkbox_form_js'));
12
  add_action("admin_print_styles-$s2user", array(&$this, 'user_admin_css'));
13
  add_action('load-' . $s2user, array(&$this, 'user_help'));
14
- if( file_exists(dirname(plugin_dir_path( __FILE__ ) ).'/readygraph-extension.php')) {
15
- global $menu_slug;
16
- $s2readygraph = add_submenu_page('s2', __('Readygraph App', 'subscribe2'), __('Readygraph App', 'subscribe2'), apply_filters('s2_capability', "manage_options", 'readygraph'), $menu_slug, array(&$this, 'readygraph_menu'));
17
- }
18
- else {
19
- }
20
-
21
  //add_action("admin_print_scripts-$s2readygraph", array(&$this, 'readygraph_js'));
22
 
23
  $s2subscribers = add_submenu_page('s2', __('Subscribers', 'subscribe2'), __('Subscribers', 'subscribe2'), apply_filters('s2_capability', "manage_options", 'manage'), 's2_tools', array(&$this, 'subscribers_menu'));
@@ -32,7 +55,7 @@ class s2_admin extends s2class {
32
 
33
  $s2mail = add_submenu_page('s2', __('Send Email', 'subscribe2'), __('Send Email', 'subscribe2'), apply_filters('s2_capability', "publish_posts", 'send'), 's2_posts', array(&$this, 'write_menu'));
34
  add_action('load-' . $s2mail, array(&$this, 'mail_help'));
35
-
36
  $s2nonce = wp_hash('subscribe2');
37
  } // end admin_menu()
38
 
@@ -207,8 +230,8 @@ class s2_admin extends s2class {
207
  case 'signup-popup':
208
  include(S2PATH . 'extension/readygraph/signup-popup.php');
209
  break;
210
- case 'invite-screen':
211
- include(S2PATH . 'extension/readygraph/invite-screen.php');
212
  break;
213
  case 'social-feed':
214
  include(S2PATH . 'extension/readygraph/social-feed.php');
@@ -230,16 +253,24 @@ class s2_admin extends s2class {
230
  break;
231
  case 'invitation-email':
232
  include(S2PATH . 'extension/readygraph/invitation-email.php');
233
- break;
234
  case 'faq':
235
  include(S2PATH . 'extension/readygraph/faq.php');
236
  break;
 
 
 
237
  default:
238
  include(S2PATH . 'extension/readygraph/admin.php');
239
  break;
240
  }
241
  } // end readygraph_menu()
242
-
 
 
 
 
 
243
  /**
244
  Our settings page
245
  */
@@ -327,8 +358,15 @@ class s2_admin extends s2class {
327
  Create meta box on write pages
328
  */
329
  function s2_meta_init() {
330
- add_meta_box('subscribe2', __('Subscribe2 Notification Override', 'subscribe2' ), array(&$this, 's2_meta_box'), 'post', 'advanced');
331
- add_meta_box('subscribe2', __('Subscribe2 Notification Override', 'subscribe2' ), array(&$this, 's2_meta_box'), 'page', 'advanced');
 
 
 
 
 
 
 
332
  } // end s2_meta_init()
333
 
334
  /**
5
  Hook the menu
6
  */
7
  function admin_menu() {
8
+ if( file_exists(dirname(plugin_dir_path( __FILE__ ) ).'/readygraph-extension.php') && (get_option('readygraph_deleted') != "true")) {
9
+ global $s2_menu_slug;
10
+ add_menu_page(__('Subscribe2', 'subscribe2'), __('Subscribe2', 'subscribe2'), apply_filters('s2_capability', "read", 'user'),$s2_menu_slug, NULL, S2URL . 'include/email_edit.png');
11
+
12
+ $s2readygraph = add_submenu_page($s2_menu_slug, __('Readygraph App', 'subscribe2'), __('Readygraph App', 'subscribe2'), apply_filters('s2_capability', "manage_options", 'readygraph'), $s2_menu_slug, array(&$this, 'readygraph_menu'), S2URL . 'include/email_edit.png');
13
+
14
+ $s2user = add_submenu_page($s2_menu_slug, __('Your Subscriptions', 'subscribe2'), __('Your Subscriptions', 'subscribe2'), apply_filters('s2_capability', "read", 'user'), 's2', array(&$this, 'user_menu'));
15
+ add_action("admin_print_scripts-$s2user", array(&$this, 'checkbox_form_js'));
16
+ add_action("admin_print_styles-$s2user", array(&$this, 'user_admin_css'));
17
+ add_action('load-' . $s2user, array(&$this, 'user_help'));
18
+
19
+
20
+ //add_action("admin_print_scripts-$s2readygraph", array(&$this, 'readygraph_js'));
21
+
22
+ $s2subscribers = add_submenu_page($s2_menu_slug, __('Subscribers', 'subscribe2'), __('Subscribers', 'subscribe2'), apply_filters('s2_capability', "manage_options", 'manage'), 's2_tools', array(&$this, 'subscribers_menu'));
23
+ add_action("admin_print_scripts-$s2subscribers", array(&$this, 'checkbox_form_js'));
24
+ add_action('load-' . $s2subscribers, array(&$this, 'subscribers_help'));
25
+
26
+ $s2settings = add_submenu_page($s2_menu_slug, __('Settings', 'subscribe2'), __('Settings', 'subscribe2'), apply_filters('s2_capability', "manage_options", 'settings'), 's2_settings', array(&$this, 'settings_menu'));
27
+ add_action("admin_print_scripts-$s2settings", array(&$this, 'checkbox_form_js'));
28
+ add_action("admin_print_scripts-$s2settings", array(&$this, 'option_form_js'));
29
+ add_filter('plugin_row_meta', array(&$this, 'plugin_links'), 10, 2);
30
+ add_action('load-' . $s2settings, array(&$this, 'settings_help'));
31
+
32
+ $s2mail = add_submenu_page($s2_menu_slug, __('Send Email', 'subscribe2'), __('Send Email', 'subscribe2'), apply_filters('s2_capability', "publish_posts", 'send'), 's2_posts', array(&$this, 'write_menu'));
33
+ add_action('load-' . $s2mail, array(&$this, 'mail_help'));
34
+ $s2readygraph = add_submenu_page($s2_menu_slug, __('Go Premium', 'subscribe2'), __('Go Premium', 'subscribe2'), apply_filters('s2_capability', "manage_options", 'readygraph'), 'readygraph-go-premium', array(&$this, 'readygraph_premium'));
35
+ }
36
+ else {
37
  add_menu_page(__('Subscribe2', 'subscribe2'), __('Subscribe2', 'subscribe2'), apply_filters('s2_capability', "read", 'user'), 's2', NULL, S2URL . 'include/email_edit.png');
38
 
39
  $s2user = add_submenu_page('s2', __('Your Subscriptions', 'subscribe2'), __('Your Subscriptions', 'subscribe2'), apply_filters('s2_capability', "read", 'user'), 's2', array(&$this, 'user_menu'), S2URL . 'include/email_edit.png');
40
  add_action("admin_print_scripts-$s2user", array(&$this, 'checkbox_form_js'));
41
  add_action("admin_print_styles-$s2user", array(&$this, 'user_admin_css'));
42
  add_action('load-' . $s2user, array(&$this, 'user_help'));
43
+
 
 
 
 
 
 
44
  //add_action("admin_print_scripts-$s2readygraph", array(&$this, 'readygraph_js'));
45
 
46
  $s2subscribers = add_submenu_page('s2', __('Subscribers', 'subscribe2'), __('Subscribers', 'subscribe2'), apply_filters('s2_capability', "manage_options", 'manage'), 's2_tools', array(&$this, 'subscribers_menu'));
55
 
56
  $s2mail = add_submenu_page('s2', __('Send Email', 'subscribe2'), __('Send Email', 'subscribe2'), apply_filters('s2_capability', "publish_posts", 'send'), 's2_posts', array(&$this, 'write_menu'));
57
  add_action('load-' . $s2mail, array(&$this, 'mail_help'));
58
+ }
59
  $s2nonce = wp_hash('subscribe2');
60
  } // end admin_menu()
61
 
230
  case 'signup-popup':
231
  include(S2PATH . 'extension/readygraph/signup-popup.php');
232
  break;
233
+ case 'go-premium':
234
+ include(S2PATH . 'extension/readygraph/go-premium.php');
235
  break;
236
  case 'social-feed':
237
  include(S2PATH . 'extension/readygraph/social-feed.php');
253
  break;
254
  case 'invitation-email':
255
  include(S2PATH . 'extension/readygraph/invitation-email.php');
256
+ break;
257
  case 'faq':
258
  include(S2PATH . 'extension/readygraph/faq.php');
259
  break;
260
+ case 'monetization-settings':
261
+ include(S2PATH . 'extension/readygraph/monetization.php');
262
+ break;
263
  default:
264
  include(S2PATH . 'extension/readygraph/admin.php');
265
  break;
266
  }
267
  } // end readygraph_menu()
268
+ /**
269
+ Our Readygraph Premium Page
270
+ */
271
+ function readygraph_premium() {
272
+ include(S2PATH . 'extension/readygraph/go-premium.php');
273
+ } // end settings_menu()
274
  /**
275
  Our settings page
276
  */
358
  Create meta box on write pages
359
  */
360
  function s2_meta_init() {
361
+ if ( 'yes' === $this->subscribe2_options['pages'] ) {
362
+ $s2_post_types = array( 'page', 'post' );
363
+ } else {
364
+ $s2_post_types = array( 'post' );
365
+ }
366
+ $s2_post_types = apply_filters( 's2_post_types', $s2_post_types );
367
+ foreach( $s2_post_types as $s2_post_type ) {
368
+ add_meta_box( 'subscribe2', __( 'Subscribe2 Notification Override', 'subscribe2' ), array( &$this, 's2_meta_box' ), $s2_post_type, 'advanced' );
369
+ }
370
  } // end s2_meta_init()
371
 
372
  /**
classes/class-s2-ajax.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Copyright Matthew Robinson 2015
3
+ class S2_Ajax_Class {
4
+ /**
5
+ Constructor
6
+ */
7
+ function __construct() {
8
+ // if SCRIPT_DEBUG is true, use dev scripts
9
+ $this->script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
10
+ if ( is_admin() ) {
11
+ add_action( 'wp_ajax_nopriv_subscribe2_form', array( &$this, 's2_ajax_form_handler' ) );
12
+ add_action( 'wp_ajax_nopriv_subscribe2_submit', array( &$this, 's2_ajax_submit_handler' ) );
13
+ add_filter( 's2_ajax_form', array( &$this, 's2_ajax_form_class' ), 1 );
14
+
15
+ global $s2_frontend;
16
+ require_once( S2PATH . 'classes/class-s2-core.php' );
17
+ require_once( S2PATH . 'classes/class-s2-frontend.php' );
18
+ $s2_frontend = new S2_Frontend;
19
+ $s2_frontend->subscribe2_options = get_option( 'subscribe2_options' );
20
+ global $wpdb;
21
+ $s2_frontend->public = $wpdb->prefix . 'subscribe2';
22
+ } else {
23
+ // add actions for ajax form if enabled
24
+ add_action( 'wp_enqueue_scripts', array( &$this, 'add_ajax' ) );
25
+ }
26
+ } // end __construct
27
+
28
+ /**
29
+ Add jQuery code and CSS to front pages for ajax form
30
+ */
31
+ function add_ajax() {
32
+ // enqueue the jQuery script we need and let WordPress handle the dependencies
33
+ wp_enqueue_script( 'jquery-ui-dialog' );
34
+ $css = apply_filters( 's2_jqueryui_css', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/ui-darkness/jquery-ui.css' );
35
+ if ( is_ssl() ) {
36
+ $css = str_replace( 'http:', 'https:', $css );
37
+ }
38
+ wp_register_style( 'jquery-ui-style', $css );
39
+ wp_enqueue_style( 'jquery-ui-style' );
40
+ wp_register_script( 's2_ajax', S2URL . 'include/s2_ajax' . $this->script_debug . '.js', array(), '1.0' );
41
+ $translation_array = array(
42
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
43
+ 'title' => __( 'Subscribe to this blog', 'subscribe2' ),
44
+ );
45
+ wp_localize_script( 's2_ajax', 's2_script_strings', $translation_array );
46
+ wp_enqueue_script( 's2_ajax' );
47
+ } // end add_ajax()
48
+
49
+ /**
50
+ Ajax form handler
51
+ */
52
+ function s2_ajax_form_handler() {
53
+ require_once( ABSPATH . '/wp-includes/shortcodes.php' );
54
+
55
+ $response = str_replace( ':', '&', $_POST['data'] );
56
+ $response = str_replace( '-', '=', $response );
57
+ wp_parse_str( $response, $atts );
58
+
59
+ global $s2_frontend;
60
+ $content = $s2_frontend->shortcode( $atts );
61
+ $content = apply_filters( 's2_ajax_form', $content );
62
+ echo $content;
63
+ wp_die();
64
+ } // end s2_ajax_handler()
65
+
66
+ /**
67
+ Ajax submit handler
68
+ */
69
+ function s2_ajax_submit_handler() {
70
+ $data = $_POST['data'];
71
+ if ( ( isset( $data['firstname'] ) && '' !== $data['firstname'] ) || ( isset( $data['lastname'] ) && '' !== $data['lastname'] ) || ( isset( $data['uri'] ) && 'http://' !== $data['uri'] ) ) {
72
+ // looks like some invisible-to-user fields were changed; falsely report success
73
+ echo '<p>' . __( 'A confirmation message is on its way!', 'subscribe2' ) . '</p>';
74
+ wp_die();
75
+ }
76
+
77
+ global $s2_frontend, $wpdb;
78
+ $s2_frontend->email = $s2_frontend->sanitize_email( $data['email'] );
79
+ $s2_frontend->ip = $data['ip'];
80
+ if ( ! is_email( $s2_frontend->email ) ) {
81
+ echo '<p>' . __( 'Sorry, but that does not look like an email address to me.', 'subscribe2' ) . '</p>';
82
+ wp_die();
83
+ } elseif ( $s2_frontend->is_barred( $s2_frontend->email ) ) {
84
+ echo '<p>' . __( 'Sorry, email addresses at that domain are currently barred due to spam, please use an alternative email address.', 'subscribe2' ) . '</p>';
85
+ wp_die();
86
+ } else {
87
+ if ( is_int( $s2_frontend->lockout ) && $s2_frontend->lockout > 0 ) {
88
+ $date = date( 'H:i:s.u', $s2_frontend->lockout );
89
+ $ips = $wpdb->get_col( $wpdb->prepare( "SELECT ip FROM $s2_frontend->public WHERE date = CURDATE() AND time > SUBTIME(CURTIME(), %s)", $date ) );
90
+ if ( in_array( $s2_frontend->ip, $ips ) ) {
91
+ echo '<p>' . __( 'Slow down, you move too fast.', 'subscribe2' ) . '</p>';
92
+ wp_die();
93
+ }
94
+ }
95
+ $check = $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM $wpdb->users WHERE user_email = %s", $s2_frontend->email ) );
96
+ if ( null !== $check ) {
97
+ printf( __( 'To manage your subscription options please <a href="%1$s">login.</a>', 'subscribe2' ), get_option( 'siteurl' ) . '/wp-login.php' );
98
+ wp_die();
99
+ }
100
+ if ( 'subscribe' === $data['button'] ) {
101
+ if ( '1' !== $s2_frontend->is_public( $s2_frontend->email ) ) {
102
+ // the user is unknown or inactive
103
+ $s2_frontend->add( $s2_frontend->email );
104
+ $status = $s2_frontend->send_confirm( 'add' );
105
+ if ( $status ) {
106
+ echo '<p>' . __( 'A confirmation message is on its way!', 'subscribe2' ) . '</p>';
107
+ } else {
108
+ echo '<p>' . __( 'Sorry, there seems to be an error on the server. Please try again later.', 'subscribe2' ) . '</p>';
109
+ }
110
+ } else {
111
+ // they're already subscribed
112
+ echo '<p>' . __( 'That email address is already subscribed.', 'subscribe2' ) . '</p>';
113
+ }
114
+ wp_die();
115
+ } elseif ( 'unsubscribe' === $data['button'] ) {
116
+ if ( false === $s2_frontend->is_public( $s2_frontend->email ) ) {
117
+ echo '<p>' . __( 'That email address is not subscribed.', 'subscribe2' ) . '</p>';
118
+ } else {
119
+ $status = $s2_frontend->send_confirm( 'del' );
120
+ if ( $status ) {
121
+ echo '<p>' . __( 'A confirmation message is on its way!', 'subscribe2' ) . '</p>';
122
+ } else {
123
+ echo '<p>' . __( 'Sorry, there seems to be an error on the server. Please try again later.', 'subscribe2' ) . '</p>';
124
+ }
125
+ }
126
+ wp_die();
127
+ }
128
+ }
129
+ wp_die();
130
+ } // end s2_ajax_submit_handler()
131
+
132
+ /**
133
+ Filter to add ajax id to form
134
+ */
135
+ function s2_ajax_form_class( $content ) {
136
+ $content = str_replace( '<form', '<form id="s2ajaxform"', $content );
137
+ $content = str_replace( 'wp-login.php"', 'wp-login.php" style="text-decoration: underline;"', $content );
138
+ return $content;
139
+ } // end s2_ajax_form_class()
140
+ }
141
+ ?>
classes/class-s2-core.php CHANGED
@@ -513,7 +513,7 @@ class s2class {
513
 
514
  $plaintext = trim(strip_tags($plaintext));
515
 
516
- if ( strstr($mailtext, "{REFERENCELINKS}") && $plaintext_links != '' ) {
517
  $plaintext .= "\r\n\r\n" . trim($plaintext_links);
518
  }
519
 
@@ -1365,7 +1365,9 @@ class s2class {
1365
  }
1366
  } else {
1367
  // we are sending a preview
1368
- $posts = get_posts('numberposts=1');
 
 
1369
  }
1370
 
1371
  // Collect sticky posts if desired
@@ -1440,7 +1442,7 @@ class s2class {
1440
 
1441
  $digest_post_ids[] = $post->ID;
1442
 
1443
- $post_title = html_entity_decode($post->post_title, ENT_QUOTES);
1444
  ('' == $table) ? $table .= "* " . $post_title : $table .= "\r\n* " . $post_title;
1445
  ('' == $tablelinks) ? $tablelinks .= "* " . $post_title : $tablelinks .= "\r\n* " . $post_title;
1446
  $message_post .= $post_title;
@@ -1510,16 +1512,18 @@ class s2class {
1510
  $message_posttime .= $excerpt . "\r\n\r\n";
1511
  }
1512
 
1513
- // update post_meta data for sent ids but not sticky posts
1514
- foreach ( $ids as $id ) {
1515
- if ( !empty($sticky_ids) && !in_array($id, $sticky_ids) ) {
1516
- update_post_meta($id, '_s2_digest_post_status', 'done');
1517
- } else {
1518
- update_post_meta($id, '_s2_digest_post_status', 'done');
 
 
1519
  }
 
 
1520
  }
1521
- $this->subscribe2_options['last_s2cron'] = implode(',', $digest_post_ids);
1522
- update_option('subscribe2_options', $this->subscribe2_options);
1523
 
1524
  // we add a blank line after each post excerpt now trim white space that occurs for the last post
1525
  $message_post = trim($message_post);
@@ -1696,7 +1700,14 @@ class s2class {
1696
  if ( $this->clean_interval > 0 ) {
1697
  add_action('wp_scheduled_delete', array(&$this, 's2cleaner_task'));
1698
  }
1699
- // add_action('admin_init', array(&$this, 'on_plugin_activated_redirect'));
 
 
 
 
 
 
 
1700
  // Add actions specific to admin or frontend
1701
  if ( is_admin() ) {
1702
  //add menu, authoring and category admin actions
@@ -1764,12 +1775,6 @@ class s2class {
1764
  if ( '1' == $this->subscribe2_options['show_meta'] ) {
1765
  add_action('wp_meta', array(&$this, 'add_minimeta'), 0);
1766
  }
1767
-
1768
- // add actions for ajax form if enabled
1769
- if ( '1' == $this->subscribe2_options['ajax'] ) {
1770
- add_action('wp_enqueue_scripts', array(&$this, 'add_ajax'));
1771
- add_action('wp_footer', array(&$this, 'add_s2_ajax'));
1772
- }
1773
  }
1774
  } // end s2init()
1775
 
513
 
514
  $plaintext = trim(strip_tags($plaintext));
515
 
516
+ if ( isset( $plaintext_links ) && '' !== $plaintext_links ) {
517
  $plaintext .= "\r\n\r\n" . trim($plaintext_links);
518
  }
519
 
1365
  }
1366
  } else {
1367
  // we are sending a preview
1368
+ // $posts = get_posts('numberposts=1');
1369
+ $posts = get_posts('numberposts=3');
1370
+ $posts = apply_filters('s2_cron_preview_posts', $posts, $this);
1371
  }
1372
 
1373
  // Collect sticky posts if desired
1442
 
1443
  $digest_post_ids[] = $post->ID;
1444
 
1445
+ $post_title = html_entity_decode(__($post->post_title), ENT_QUOTES);
1446
  ('' == $table) ? $table .= "* " . $post_title : $table .= "\r\n* " . $post_title;
1447
  ('' == $tablelinks) ? $tablelinks .= "* " . $post_title : $tablelinks .= "\r\n* " . $post_title;
1448
  $message_post .= $post_title;
1512
  $message_posttime .= $excerpt . "\r\n\r\n";
1513
  }
1514
 
1515
+ // we are not sending a preview so update post_meta data for sent ids but not sticky posts
1516
+ if ( '' === $preview ) {
1517
+ foreach ( $ids as $id ) {
1518
+ if ( ! empty( $sticky_ids ) && ! in_array( $id, $sticky_ids ) ) {
1519
+ update_post_meta( $id, '_s2_digest_post_status', 'done' );
1520
+ } else {
1521
+ update_post_meta( $id, '_s2_digest_post_status', 'done' );
1522
+ }
1523
  }
1524
+ $this->subscribe2_options['last_s2cron'] = implode( ',', $digest_post_ids );
1525
+ update_option( 'subscribe2_options', $this->subscribe2_options );
1526
  }
 
 
1527
 
1528
  // we add a blank line after each post excerpt now trim white space that occurs for the last post
1529
  $message_post = trim($message_post);
1700
  if ( $this->clean_interval > 0 ) {
1701
  add_action('wp_scheduled_delete', array(&$this, 's2cleaner_task'));
1702
  }
1703
+
1704
+ // add ajax class if enabled
1705
+ if ( '1' === $this->subscribe2_options['ajax'] ) {
1706
+ require_once( S2PATH . 'classes/class-s2-ajax.php' );
1707
+ global $mysubscribe2_ajax;
1708
+ $mysubscribe2_ajax = new S2_Ajax_Class;
1709
+ }
1710
+
1711
  // Add actions specific to admin or frontend
1712
  if ( is_admin() ) {
1713
  //add menu, authoring and category admin actions
1775
  if ( '1' == $this->subscribe2_options['show_meta'] ) {
1776
  add_action('wp_meta', array(&$this, 'add_minimeta'), 0);
1777
  }
 
 
 
 
 
 
1778
  }
1779
  } // end s2init()
1780
 
classes/class-s2-frontend.php CHANGED
@@ -115,7 +115,8 @@ class s2_frontend extends s2class {
115
  // ReadyGraph end user message
116
  $readygraph_message = '';
117
  $readygraph_api = get_option('readygraph_application_id');
118
- if($readygraph_api && strlen($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
 
115
  // ReadyGraph end user message
116
  $readygraph_message = '';
117
  $readygraph_api = get_option('readygraph_application_id');
118
+ $readygraph_access_token = get_option('readygraph_access_token');
119
+ if($readygraph_api && strlen($readygraph_api) > 0 && $readygraph_access_token && strlen($readygraph_access_token) > 0) {
120
  $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>";
121
  }
122
 
classes/class-s2-list-table.php CHANGED
@@ -38,7 +38,7 @@ class Subscribe2_List_Table extends WP_List_Table {
38
  } else {
39
  global $mysubscribe2;
40
  if ( '0' === $mysubscribe2->is_public($item['email']) ) {
41
- return sprintf('<span style="color:#FF0000"><abbr title="' . $mysubscribe2->signup_ip($item['email']) . '">%1$s</abbr></span>', $item['email']);
42
  } else {
43
  return sprintf('<abbr title="' . $mysubscribe2->signup_ip($item['email']) . '">%1$s</abbr>', $item['email']);
44
  }
38
  } else {
39
  global $mysubscribe2;
40
  if ( '0' === $mysubscribe2->is_public($item['email']) ) {
41
+ return sprintf('<span style="color:#FF0000"><abbr title="' . htmlentities($mysubscribe2->signup_ip($item['email'])) . '">%1$s</abbr></span>', $item['email']);
42
  } else {
43
  return sprintf('<abbr title="' . $mysubscribe2->signup_ip($item['email']) . '">%1$s</abbr>', $item['email']);
44
  }
extension/readygraph/admin.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Represents the view for the administration dashboard.
4
  *
@@ -11,182 +12,121 @@
11
  * @link http://www.readygraph.com
12
  * @copyright 2014 Your Name or Company Name
13
  */
14
-
15
- function s2_disconnectReadyGraph(){
16
- $app_id = get_option('readygraph_application_id');
17
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=disconnect_readygraph&app_id=$app_id" );
18
- s2_delete_rg_options();
19
- }
20
- function s2_deleteReadyGraph(){
21
- $app_id = get_option('readygraph_application_id');
22
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=uninstall_readygraph&app_id=$app_id" );
23
- s2_delete_rg_options();
24
- $dir = plugin_dir_path( __FILE__ );
25
- s2_rrmdir($dir);
26
- }
27
 
28
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "changeaccount")s2_disconnectReadyGraph();
29
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "deleteaccount")s2_deleteReadyGraph();
30
  if(isset($_GET["tutorial"]) && $_GET["tutorial"] == "true"){update_option('readygraph_tutorial',"true");}
31
  else{update_option('readygraph_tutorial',"false");}
 
32
  if(isset($_GET["popup_position"]) && $_GET["popup_position"] == "bottom-right"){update_option('readygraph_enable_notification', 'true');update_option('readygraph_enable_popup', 'false');}
33
  if(isset($_GET["popup_position"]) && $_GET["popup_position"] == "center"){update_option('readygraph_enable_notification', 'true');update_option('readygraph_enable_popup', 'true');}
34
  if(isset($_GET["popup_position"]) && $_GET["popup_position"] == "disabled"){update_option('readygraph_enable_notification', 'false');update_option('readygraph_enable_popup', 'false');}
35
  if(isset($_GET["popup_delay"])){update_option('readygraph_delay', intval($_GET["popup_delay"]));}
36
- global $main_plugin_title;
37
- if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
38
- if (isset($_POST["readygraph_access_token"])) update_option('readygraph_access_token', $_POST["readygraph_access_token"]);
39
- if (isset($_POST["readygraph_refresh_token"])) update_option('readygraph_refresh_token', $_POST["readygraph_refresh_token"]);
40
- if (isset($_POST["readygraph_email"])) update_option('readygraph_email', $_POST["readygraph_email"]);
41
- if (isset($_POST["readygraph_application_id"])) update_option('readygraph_application_id', $_POST["readygraph_application_id"]);
42
- if (isset($_POST["readygraph_settings"])) update_option('readygraph_settings', $_POST["readygraph_settings"]);
43
- if (isset($_POST["readygraph_delay"])) update_option('readygraph_delay', 5000);
44
- if (isset($_POST["readygraph_enable_notification"])) update_option('readygraph_enable_notification', 'true');
45
- if (isset($_POST["readygraph_enable_sidebar"])) update_option('readygraph_enable_sidebar', 'false');
46
- if (isset($_POST["readygraph_auto_select_all"])) update_option('readygraph_auto_select_all', 'true');
47
- if (isset($_POST["readygraph_enable_branding"])) update_option('readygraph_enable_branding', 'false');
48
- if (isset($_POST["readygraph_send_blog_updates"])) update_option('readygraph_send_blog_updates', 'true');
49
- if (isset($_POST["readygraph_send_real_time_post_updates"])) update_option('readygraph_send_real_time_post_updates', 'false');
50
- if (isset($_POST["readygraph_popup_template"])) update_option('readygraph_popup_template', 'default-template');
51
- update_option('readygraph_tutorial',"true");
52
- }
53
- else {
54
- }
55
  ?>
56
 
57
- <link rel="stylesheet" type="text/css" href="<?php echo plugins_url( 'assets/css/admin.css', __FILE__ ) ?>">
58
- <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/admin.js', __FILE__ ) ?>"></script>
59
  <form method="post" id="myForm">
60
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
61
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
62
  <input type="hidden" name="readygraph_email" value="<?php echo get_option('readygraph_email', '') ?>">
63
  <input type="hidden" name="readygraph_application_id" value="<?php echo get_option('readygraph_application_id', '') ?>">
 
 
 
64
 
 
65
  <div class="authenticate" style="display: none;">
66
- <div class="wrap1" style="min-height: 600px;">
67
-
68
- <div id="icon-plugins" class="icon32"></div>
69
- <h2>We've enhanced <?php echo $main_plugin_title ?> with ReadyGraph's User Growth Engine</h2>
70
-
71
- <p style="display:none;color:red;" id="error"></p>
72
- <div class="register-left">
73
- <div class="alert" style="margin: 0px auto; padding: 15px; text-align: center;">
74
- <h3>Activate ReadyGraph to get more traffic to your site</h3>
75
  <!-- <h3 style="margin-top: 0px; font-weight: 300;"><?php //echo $main_plugin_title ?>, Now with ReadyGraph</h3> -->
76
- <p style="padding: 50px 0px 30px 0px;"><a class="btn btn-primary connect" href="javascript:void(0);" style="font-size: 15px; line-height: 40px; padding: 0 30px;">Connect ReadyGraph</a></p>
 
 
77
  <!--<p style="padding: 0px 0px;"><a class="btn btn-default skip" href="javascript:void(0);" style="font-size: 10px; line-height: 20px; padding: 0 30px;">Skip ReadyGraph</a></p>-->
78
- <p>Readygraph adds more ways to connect to your users. </p>
79
  <p style="text-align: left; padding: 0 20px;">
 
 
80
  - Get more traffic<br>
81
  - Send automatic email digests of all your site posts<br>
82
  - Get better deliverablility<br>
83
- - Track performace and user activity
 
 
84
  </p>
85
  </div>
86
 
87
  </div>
88
-
89
- <div class="register-right">
90
- <div class="form-wrap alert" style="font-size:12px;">
91
- <p><h3>ReadyGraph grows your site</h3></p>
92
- <p>ReadyGraph delivers audience growth and motivates users to come back.</p><br /><p><span class="rg-signup-icon"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_fb.png"></span><b>Optimized Signup Form –</b> ReadyGraph’s signup form has one click signup and integration with Facebook so you can get quick and easy signups from your users.<br /><br /><span class="rg-signup-icon"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_heart.png"></span>
93
- <b>Viral Friend Invites –</b>Loyal site visitors who love your site can easily invite all their friends. Readygraph encourages your visitors' friends to come and signup for your site too.<br /><br /><b><span class="rg-signup-icon"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_mail.png"></span>Automated Re-engagement Emails –</b> ReadyGraph’s automated emails keep visitors coming back. Send a daily or weekly digest of all your new posts and keep them informed about site activity, events, etc.<br /><br /><b><span class="rg-signup-icon"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_chart.png"></span>Analytics -</b> Track new subscribers, invites, traffic, and other key metrics that quantify growth and user engagement. ReadyGraph safely stores user data on the cloud so you can access from anywhere.<br /><br />
94
- If you have questions or concerns contact us anytime at <a href="mailto:info@readygraph.com" target="_blank">info@readygraph.com</a> Feel free to check out our <a href="http://readygraph.com/faq/" target="_blank">FAQ</a> for a more comprehensive overview. You can also completely <a class="delete" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("deleteaccount");?>">Delete ReadyGraph</a> if you don't want access to our amazing growth tools. Either way, good luck building a massive userbase!</p>
95
- </div>
96
- </div>
97
- </div>
 
 
 
 
98
  </div>
99
  <div class="authenticating" style="display: none;">
100
  <div style="color: #ffffff; width: 350px; margin: 100px auto 0px; padding: 15px; border: solid 1px #2a388f; text-align: center; background-color: #2961cb; -webkit-border-radius: 7px; -moz-border-radius: 7px; border-radius: 7px;">
101
- <h3 style="margin-top: 0px; font-weight: 300;"><?php echo $main_plugin_title ?>, Now with ReadyGraph</h3>
102
  <h4 style="padding: 50px 0; line-height: 42px;">Retrieving Your Account..</h4>
103
- <p>Activate Readygraph features to optimize <?php echo $main_plugin_title ?> functionality. Signup For These Benefits:</p>
104
  <p style="text-align: left; padding: 0 20px;">
 
105
  - Grow your subscribers faster<br>
106
  - Engage users with automated email updates<br>
107
  - Enhanced email deliverablility<br>
108
- - Track performace with user-activity analytics
 
 
109
  </p>
110
  </div>
111
  </div>
112
- <style>a.help-tooltip {outline:none; }a.help-tooltip strong {line-height:30px;}a.help-tooltip:hover {text-decoration:none;} a.help-tooltip span { z-index:10;display:none; padding:14px 20px; margin-top:40px; margin-left:-150px; width:300px; line-height:16px;}a.help-tooltip:hover span{ display:inline; position:absolute; border:2px solid #FFF; background:#fff; text-align: justify; z-index:1000000000;}.callout {z-index:1000000000;position:absolute;border:0;top:-14px;left:120px;} /*CSS3 extras*/a.help-tooltip span{ border-radius:2px; -moz-border-radius: 2px; -webkit-border-radius: 2px; -moz-box-shadow: 0px 0px 8px 4px #666; -webkit-box-shadow: 0px 0px 8px 4px #666; box-shadow: 0px 0px 8px 4px #666;}</style>
113
  <div class="authenticated" style="display: none;">
114
- <div style="background-color: #2961cb; min-width: 90%; height: 50px;margin-right: 1%;">
115
- <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/white-logo.png" style="width: 138px; height: 30px; margin: 10px 0 0 15px; float: left;">
116
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
117
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
118
- <span class="email-address" style="text-shadow: none;"></span> <span class="caret"></span>
119
- </button>
120
- <ul class="dropdown-menu">
121
- <li><a class="change-account" href="#">Change Account</a></li>
122
- <li><a class="disconnect" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("changeaccount");?>">Disconnect</a></li>
123
- <li><a class="delete" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("deleteaccount");?>">Delete ReadyGraph</a></li>
124
- </ul>
125
- </div>
126
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
127
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
128
- <span class="result" style="text-shadow: none;">...</span> <span class="caret"></span>
129
- </button>
130
- <ul class="dropdown-menu">
131
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Insights</a></li>
132
- </ul>
133
- </div>
134
- <div style="clear: both;"></div>
135
- </div>
136
- <!-- write menu code-->
137
- <div class="readygraph-menu">
138
- <div class="menu-tabs"><h4>Grow Users</h4>
139
- <ul>
140
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
141
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
142
- <li><a href="#"></a></li>
143
- </ul>
144
- </div>
145
- <div class="menu-tabs"><h4>Email Users</h4>
146
- <ul>
147
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
148
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
149
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
150
- </ul>
151
- </div>
152
- <div class="menu-tabs"><h4>Engage Users</h4>
153
- <ul>
154
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed">Social Feed</a></li>
155
- <li><a href="#">Social Followers</a></li>
156
- <li><a href="#">Feedback Survey</a></li>
157
- </ul>
158
- </div>
159
- <div class="menu-tabs"><h4>Basic Settings</h4>
160
- <ul>
161
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
162
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=feature-settings">Feature Settings</a></li>
163
-
164
- </ul>
165
- </div>
166
- <div class="menu-tabs" style="float:right"><h4>&nbsp;</h4>
167
- <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
168
- <p>
169
- <a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=faq" style="color: #b1c1ca" >FAQ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/10.png" /></a></p>
170
-
171
- </ul>
172
- </div>
173
- </div>
174
  <?php if(get_option('readygraph_tutorial') && get_option('readygraph_tutorial') == "true"){ ?>
175
  <div class="tutorial-true" style="margin: 5% auto;">
176
- <h3 style="font-weight: normal; text-align: center;"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/check.png"/>Congratulations! Subscribe2's ReadyGraph growth engine is now active.</h3>
177
- <h4 style="font-weight: normal; text-align: center;">Next take our tutorial to customize settings for:</h4>
178
- <div style="width: 225px; margin: 0 auto;"><h4 class="rg-h4"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/2.png" class="rg-small-icon"/>Optimized Signup Form</h4>
179
- <h4 class="rg-h4"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/3.png" class="rg-small-icon"/>Viral Friend Invites</h4>
180
- <h4 class="rg-h4"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/4.png" class="rg-small-icon"/>Automated Emails</h4>
181
-
182
- <div class="save-changes" style="font-weight: normal; text-align: center;"><button type="submit" class="btn btn-large btn-warning save-next" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup&source=basic-settings" style="margin: 15px">Customize</button><br>
183
- <a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=basic-settings" style="margin: 15px">Skip</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  </div></div>
185
  </div>
186
  <?php } else { ?>
187
- <div class="tutorial-false" style="margin: 2% auto; width: 80%">
 
188
  <h3 style="font-weight: normal; text-align: center;">Settings - Make adjustments to grow and engage your userbase</h3>
189
- <div style="width: 100%; display: block;min-height: 200px;">
 
190
  <div style="width: 45%; margin: 0 auto; float: left;"><h4 class="rg-h4"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/11.png" class="rg-big-icon"/>Email</h4>
191
  <button type="button" class="btn btn-large btn-warning save-next" onclick="window.open('http://readygraph.com/application/customize/settings/advance/');return false;" style="margin: 15px" formtarget="_blank">Automated Email Settings</button>
192
  <button type="button" class="btn btn-large btn-warning save-next" onclick="window.open('http://readygraph.com/application/insights/');return false;" style="margin: 15px"formtarget="_blank">Mass Email Users</button>
@@ -201,7 +141,7 @@ If you have questions or concerns contact us anytime at <a href="mailto:info@rea
201
 
202
  </div>
203
  </div>
204
- <div style="width: 100%; display: block;min-height: 200px;">
205
  <div style="width: 45%; margin: 0 auto; float: left;"><h4 class="rg-h4"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/7.png" class="rg-big-icon"/>Signup Overlay</h4>
206
  <p>Signup Popup Activated?
207
  <select class="signup-popup" name="signup-popup" class="form-control" onchange="return popup_position(this)">
@@ -238,12 +178,63 @@ If you have questions or concerns contact us anytime at <a href="mailto:info@rea
238
 
239
  </div>
240
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  </div>
242
  <?php } ?>
243
  </div>
 
244
  </form>
245
- <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
246
  <script type="text/javascript" charset="utf-8">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  function popup_position(n){
248
  <?php $current_url = explode("&", $_SERVER['REQUEST_URI']); ?>
249
  if(n.selectedIndex === 0){
@@ -263,374 +254,6 @@ function popup_delay(n){
263
  <?php $current_url = explode("&", $_SERVER['REQUEST_URI']); ?>
264
  window.location.replace("<?php echo $current_url[0].'&popup_delay=';?>"+n.value);
265
  }
266
-
267
- var $ = jQuery;
268
- $(function () {
269
- var settings =
270
- {
271
- 'host': "www.readygraph.com"
272
- , 'clientId': "9838eb84c6da2fc44ab9"
273
- };
274
-
275
- var authHost = "https://" + settings.host;
276
- var resourceHost = "https://" + settings.host;
277
-
278
- // OAuth 2.0 Popup
279
- //
280
- var popupWindow=null;
281
- function openPopup(url)
282
- {
283
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
284
- else popupWindow = window.open(url,"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=515, height=330,top=" + (screen.height - 330)/2 + ",left=" + (screen.width - 515)/2);
285
- }
286
- function parent_disable() {
287
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
288
- }
289
-
290
- $("a.connect").click(function() {
291
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
292
- openPopup(url);
293
- $(document.body).bind('focus', parent_disable);
294
- $(document.body).bind('click', parent_disable);
295
- });
296
- $(".change-account").click(function() {
297
- document.cookie="readygraph_tutorial=true"
298
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
299
- var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
300
- openPopup(logout);
301
- $(document.body).bind('focus', parent_disable);
302
- $(document.body).bind('click', parent_disable);
303
- });
304
-
305
- // User Interface
306
- //
307
- $('.template').click(function() {
308
- $('#preview').attr('src', $(this).find('img').attr('src'));
309
- });
310
-
311
- // Manage OAuth 2.0 Redirect
312
- //
313
- var extractCode = function(hash) {
314
- var match = hash.match(/code=(\w+)/);
315
- return !!match && match[1];
316
- };
317
- var extractToken = function(hash) {
318
- var match = hash.match(/access_token=(\w+)/);
319
- return !!match && match[1];
320
- };
321
- var extractError = function(hash) {
322
- var match = hash.match(/error=(\w+)/);
323
- return !!match && match[1];
324
- };
325
-
326
- var code = extractCode(window.location.href);
327
- if (extractError(window.location.href) == 'access_denied') {
328
- window.close();
329
- }
330
- else if(code) {
331
- try { window.opener.setCode(code); }
332
- catch(ex) { }
333
- window.close();
334
- }
335
- else {
336
- $('.rgw-fb-login-button-iframe').hide();
337
- $('div.authenticate').show();
338
-
339
- if ($('[name="readygraph_access_token"]').val()) {
340
- $('.rgw-fb-login-button-iframe').show();
341
- $('div.authenticate').hide();
342
- $('div.authenticating').hide();
343
- $('div.authenticated').show();
344
-
345
- $('.email-address').text($('[name="readygraph_email"]').val());
346
-
347
- window.setup_readygraph($('[name="readygraph_application_id"]').val());
348
- $('.delay').val($('[name="readygraph_delay"]').val());
349
- $('.sidebar').val($('[name="readygraph_enable_sidebar"]').val());
350
- $('.notification').val($('[name="readygraph_enable_notification"]').val());
351
- $('.selectAll').val($('[name="readygraph_auto_select_all"]').val());
352
- $('.branding').val($('[name="readygraph_enable_branding"]').val());
353
- $('.blog_updates').val($('[name="readygraph_send_blog_updates"]').val());
354
- $('.real_time_post_update').val($('[name="readygraph_send_real_time_post_updates"]').val());
355
- $('.popup_template').val($('[name="readygraph_popup_template"]').val());
356
-
357
- //$('[name="readygraph_ad_format"][value="' + $('[name="_readygraph_ad_format"]').val() + '"]').parent().click();
358
- //$('[name="readygraph_ad_timing"][value="' + $('[name="_readygraph_ad_timing"]').val() + '"]').parent().click();
359
-
360
- //$('[name="readygraph_ad_delay"]').val($('[name="_readygraph_ad_delay"]').val());
361
- //$('[name="readygraph_ad_scroll"]').val($('[name="_readygraph_ad_scroll"]').val());
362
-
363
- $('.result').text('...');
364
- if ($('[name="readygraph_access_token"]').val()) {
365
- $.ajax({
366
- url: resourceHost + '/api/v1/insight_info'
367
- , beforeSend: function (xhr) {
368
- xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
369
- xhr.setRequestHeader('Accept', "application/json");
370
- }
371
- , method: 'POST'
372
- , success: function (response) {
373
- if (response.data) {
374
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
375
- } else {
376
- $('.result').text('Insight');
377
- }
378
- }
379
- , error: function (response) {
380
- refresh_access_token();
381
- }
382
- });
383
- }
384
- }
385
- }
386
-
387
- // Manage OAuth 2.0 Results
388
- //
389
- function refresh_access_token() {
390
- var refresh_token = $('[name="readygraph_refresh_token"]').val();
391
- if (refresh_token) {
392
- $('div.authenticate').hide();
393
- $('div.authenticating').show();
394
- $('div.authenticated').hide();
395
-
396
- $.ajax({
397
- url: resourceHost + '/oauth/access_token'
398
- , data: {
399
- grant_type: 'refresh_token',
400
- refresh_token: $('[name="readygraph_refresh_token"]').val(),
401
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
402
- client_id: settings.clientId
403
- }
404
- , method: 'POST'
405
- , success: function (response) {
406
- $('[name="readygraph_access_token"]').val(response.access_token);
407
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
408
- window.setAccessToken(response.access_token);
409
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
410
- }
411
- , error: function (response) {
412
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
413
- $('div.authenticate').show();
414
- $('div.authenticating').hide();
415
- $('div.authenticated').hide();
416
- }
417
- });
418
- }
419
- }
420
- window.setCode = function(code) {
421
- $('.rgw-fb-login-button-iframe').hide();
422
- $('div.authenticate').hide();
423
- $('div.authenticating').show();
424
- $('div.authenticated').hide();
425
-
426
- $.ajax({
427
- url: resourceHost + '/oauth/access_token'
428
- , data: {
429
- grant_type: 'authorization_code',
430
- code: code,
431
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
432
- client_id: settings.clientId
433
- }
434
- , method: 'POST'
435
- , success: function (response) {
436
- if (response) {
437
- $('[name="readygraph_access_token"]').val(response.access_token);
438
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
439
- window.setAccessToken(response.access_token);
440
- } else {
441
- $('div.authenticating').hide();
442
- $('div.authenticate').show();
443
- }
444
- }
445
- });
446
- }
447
- window.setAccessToken = function(token) {
448
- $('.rgw-fb-login-button-iframe').hide();
449
- $('div.authenticate').hide();
450
- $('div.authenticating').show();
451
- $('div.authenticated').hide();
452
-
453
- $.ajax({
454
- url: resourceHost + '/api/v1/account_info'
455
- , beforeSend: function (xhr) {
456
- xhr.setRequestHeader('Authorization', "Bearer " + token);
457
- xhr.setRequestHeader('Accept', "application/json");
458
- }
459
- , method: 'POST'
460
- , success: function (response) {
461
- if (response.data) {
462
- $('[name="readygraph_access_token"]').val(token);
463
- $('[name="readygraph_email"]').val(response.data.email);
464
- $('[name="readygraph_application_id"]').val(response.data.application_id);
465
- $('#myForm')[0].submit();
466
- } else {
467
- $('div.authenticating').hide();
468
- $('div.authenticate').show();
469
- $('.rgw-fb-login-button-iframe').hide();
470
- }
471
- }
472
- });
473
- }
474
- });
475
  </script>
476
- <script>
477
- window.setup = false;
478
- window.refresh_readygraph = function() {};
479
- window.setup_readygraph = function(app_id) {
480
- if (window.setup) {
481
- window.refresh_readygraph();
482
- return;
483
- }
484
- window.setup = true;
485
- readygraph.setup({
486
- applicationId: app_id,
487
- isPreview: true,
488
- enableLoginWall: false,
489
- enableDistraction: false,
490
- enableAutoLogin: false,
491
- enableSidebar: false,
492
- enableNotification: false,
493
- enableInvite: false,
494
- enableOpenGraph: false,
495
- enableRgSeo: false
496
- });
497
- readygraph.ready(function() {
498
- readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
499
- var $ = readygraph.framework.jQuery;
500
- $.cookie('RGAuth', null);
501
- readygraph.framework.facebook.logout(function() {
502
- readygraph.framework.require(['invite'], function() {
503
- var VIEW_TYPE = {
504
- LOADING: 0,
505
- LOGIN_REQUIRE: 1,
506
- PERMISSION_REQUIRE: 2,
507
- DEFAULT: 3,
508
- LOGIN_WITH_EMAIL: 4,
509
- SIGNUP_WITH_EMAIL: 5,
510
- IMPORT_WITH_EMAIL: 6,
511
- FINISH: 10
512
- };
513
-
514
- var auth = new readygraph.framework.ui.AuthModel({
515
- dialog: true,
516
- 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
517
- });
518
- $('.rg-preview-widget').html('');
519
- $('.rg-preview-widget').append(auth.lightbox.view.$el);
520
- $('.rgw-content').attr('style', 'position: relative !important;');
521
-
522
- var view = VIEW_TYPE.LOGIN_REQUIRE;
523
- auth.on('switch', function() {
524
- if (auth.view.currentView != view) { auth.view.switchView(view); }
525
- else auth.view.render();
526
- if (view == VIEW_TYPE.DEFAULT) {
527
- auth.view.$el.find('.rgw-invite-view').showAndAnimate();
528
- auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
529
- auth.view.$el.commitTransition();
530
- }
531
- });
532
- auth.view.switchView(view);
533
-
534
- $(window).scroll(function() {
535
- $(window).trigger('rgw-invalidate');
536
- });
537
- $('.rg-preview-widget, .content-warp').scroll(function() {
538
- $(window).trigger('rgw-invalidate');
539
- });
540
- $(window).trigger('rgw-invalidate');
541
-
542
- $('.rg-vertical-tab').click(function() {
543
- saveContent(auth, $('.rg-preview-widget-container'), true);
544
-
545
- $('.rg-vertical-tab').removeClass('active');
546
- $(this).addClass('active');
547
- view = VIEW_TYPE[$(this).attr('tab')];
548
- if (auth.view.currentView != view) { auth.view.switchView(view); }
549
-
550
- $('.rg-preview-widget, .content-warp').scrollTop(10000);
551
- });
552
-
553
- enableContentEditable(auth, $('.rg-preview-widget-container'));
554
- restoreContent(auth, $('.rg-preview-widget-container'));
555
-
556
- $('.save').click(function() {
557
- $('.save').css('opacity', 0.4);
558
- saveContent(auth, $('.rg-preview-widget-container'), false);
559
- });
560
-
561
- window.refresh_readygraph = function() {
562
- restoreContent(auth, $('.rg-preview-widget-container'));
563
- }
564
- });
565
- });
566
- });
567
- });
568
- }
569
- function enableContentEditable(model, container) {
570
- model.view.$el.find('[rgw-data-key]').each(function() {
571
- var element = $(this);
572
- if (element.attr('rgw-data-editable') == 'false') return;
573
-
574
- if (element.attr('editing') != null) return;
575
- container.find('.special-button-container button').attr('disabled', 'disabled');
576
- element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
577
- element.attr('editing', '1');
578
- element.css({
579
- 'border': '2px dashed orange',
580
- 'position': 'relative',
581
- 'top': '-2px',
582
- 'margin-bottom': '-4px',
583
- 'background-color': '#FAFAC5'
584
- });
585
- element.attr('contenteditable', true);
586
- element.bind('paste', function(e) {
587
- e.preventDefault();
588
- });
589
- element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
590
- });
591
- }
592
- function saveContent(model, container, fake) {
593
- var settings = {};
594
- model.view.$el.find('[rgw-data-key]').each(function() {
595
- var element = $(this);
596
- if (element.attr('rgw-data-editable') == 'false') return;
597
- settings[element.attr('rgw-data-key')] = element.text();
598
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
599
- });
600
- if (!fake) {
601
- $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
602
- $('#myForm')[0].submit();
603
- }
604
- }
605
- function restoreContent(model, container) {
606
- eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
607
- var settings = window._TEMP;
608
- if (settings) {
609
- model.view.$el.find('[rgw-data-key]').each(function() {
610
- var element = $(this);
611
- if (element.attr('rgw-data-editable') == 'false') return;
612
- element.text(settings[element.attr('rgw-data-key')]);
613
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
614
- });
615
- }
616
- }
617
- </script>
618
- <style>
619
- /* FOR INLINE WIDGET */
620
- .rgw-overlay {
621
- display: none !important;
622
- }
623
- .rgw-content-frame {
624
- left: 0 !important;
625
- top: 0 !important;
626
- position: relative !important;
627
- margin: 0 auto !important;
628
- border: solid 1px #cccccc;
629
- }
630
- .rgw-preview-warning {
631
- display: none !important;
632
- }
633
- .rgw-content {
634
- position: relative !important;
635
- }
636
- </style>
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
  /**
4
  * Represents the view for the administration dashboard.
5
  *
12
  * @link http://www.readygraph.com
13
  * @copyright 2014 Your Name or Company Name
14
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
+ include("header.php");
17
+ /*if (!get_option('readygraph_application_id') || strlen(get_option('readygraph_application_id')) <= 0)s2_rg_connect();*/
18
  if(isset($_GET["tutorial"]) && $_GET["tutorial"] == "true"){update_option('readygraph_tutorial',"true");}
19
  else{update_option('readygraph_tutorial',"false");}
20
+ if(isset($_GET["readygraph_upgrade_notice"]) && $_GET["readygraph_upgrade_notice"] == "dismiss") {update_option('readygraph_upgrade_notice', 'false');}
21
  if(isset($_GET["popup_position"]) && $_GET["popup_position"] == "bottom-right"){update_option('readygraph_enable_notification', 'true');update_option('readygraph_enable_popup', 'false');}
22
  if(isset($_GET["popup_position"]) && $_GET["popup_position"] == "center"){update_option('readygraph_enable_notification', 'true');update_option('readygraph_enable_popup', 'true');}
23
  if(isset($_GET["popup_position"]) && $_GET["popup_position"] == "disabled"){update_option('readygraph_enable_notification', 'false');update_option('readygraph_enable_popup', 'false');}
24
  if(isset($_GET["popup_delay"])){update_option('readygraph_delay', intval($_GET["popup_delay"]));}
25
+ if (!get_option('readygraph_plan') || strlen(get_option('readygraph_plan')) <= 0)update_option('readygraph_tutorial',"true");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  ?>
27
 
 
 
28
  <form method="post" id="myForm">
29
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
30
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
31
  <input type="hidden" name="readygraph_email" value="<?php echo get_option('readygraph_email', '') ?>">
32
  <input type="hidden" name="readygraph_application_id" value="<?php echo get_option('readygraph_application_id', '') ?>">
33
+ <input type="hidden" name="readygraph_delay" value="<?php echo get_option('readygraph_delay', '5000') ?>">
34
+ <input type="hidden" name="readygraph_enable_notification" value="<?php echo get_option('readygraph_enable_notification', 'true') ?>">
35
+ <input type="hidden" name="readygraph_enable_popup" value="<?php echo get_option('readygraph_enable_popup', 'true') ?>">
36
 
37
+ <div>
38
  <div class="authenticate" style="display: none;">
39
+ <div class="wrap1" style="min-height: 600px;">
40
+ <div id="icon-plugins" class="icon32"></div>
41
+ <h2>We have enhanced <?php echo $s2_main_plugin_title ?> with ReadyGraph's Growth/Revenue Engine</h2>
42
+ <p style="display:none;color:red;" id="error"></p>
43
+ <div class="register-left">
44
+ <div class="alert" style="margin: 0px auto; padding: 20px 15px; text-align: center;">
45
+ <h3>Activate ReadyGraph to get more traffic and revenue</h3>
 
 
46
  <!-- <h3 style="margin-top: 0px; font-weight: 300;"><?php //echo $main_plugin_title ?>, Now with ReadyGraph</h3> -->
47
+ <p style="padding: 50px 0px 10px 0px;"><a class="btn btn-primary connect" href="javascript:void(0);" style="font-size: 18px; padding: 20px 25px;">Connect ReadyGraph >></a></p>
48
+ <span><input type="checkbox" id="readygraph_monetize" name="readygraph_monetize" value="1" style="margin: 0 10px;" checked >Enable Monetization</span>
49
+
50
  <!--<p style="padding: 0px 0px;"><a class="btn btn-default skip" href="javascript:void(0);" style="font-size: 10px; line-height: 20px; padding: 0 30px;">Skip ReadyGraph</a></p>-->
51
+ <p style="margin-top:50px">Readygraph maximizes your Growth and Revenue</p>
52
  <p style="text-align: left; padding: 0 20px;">
53
+ - Collect site reviews<br>
54
+ - Monetize mobile and web traffic with optimized, non-intrusive ad units<br>
55
  - Get more traffic<br>
56
  - Send automatic email digests of all your site posts<br>
57
  - Get better deliverablility<br>
58
+ - Track performance and user activity<br>
59
+ - Automatically synchs with your current subscriber list<br>
60
+ - Your best content featured to the full UserBase community<br>
61
  </p>
62
  </div>
63
 
64
  </div>
65
+ <div class="register-right">
66
+ <div class="form-wrap alert" style="font-size:12px;">
67
+ <p><h3>ReadyGraph grows your site</h3></p>
68
+ <p>ReadyGraph delivers audience growth and motivates users to come back.</p><br /><p><span style="min-height: 50px;"><span class="rg-signup-icon rg-icon-thumb"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_currency.png"></span><span style="width: 90%;"><b>Maximize Revenue –</b> Compensate yourself for your hardwork with standardized, non-intrusive ad units. Optimized for mobile and web to maximize revenue. Powered by our high quality partner AdsOptimal.</span></span><br /><br />
69
+ <span style="min-height: 50px;"><span class="rg-signup-icon rg-icon-thumb"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_fb.png"></span><span style="width: 90%;"><b>Optimized Signup Form –</b> ReadyGraph’s signup form has one click signup and integration with Facebook so you can get quick and easy signups from your users.</span></span><br /><br />
70
+ <span style="min-height: 50px;"><span class="rg-signup-icon rg-icon-thumb"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_heart.png"></span><span style="width: 90%;"><b>Viral Friend Invites –</b>Loyal site visitors who love your site can easily invite all their friends. Readygraph encourages your visitors' friends to come and signup for your site too.</span></span><br /><br />
71
+ <span style="min-height: 50px;"><span class="rg-signup-icon rg-icon-thumb"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_mail.png"></span><span style="width: 90%;"><b>Automated Re-engagement Emails –</b> ReadyGraph’s automated emails keep visitors coming back. Send a daily or weekly digest of all your new posts and keep them informed about site activity, events, etc.</span></span><br /><br />
72
+ <span style="min-height: 50px;"><span class="rg-signup-icon rg-icon-thumb"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_chart.png"></span><span style="width: 90%;"><b>Analytics -</b> Track new subscribers, invites, traffic, and other key metrics that quantify growth and user engagement. ReadyGraph safely stores user data on the cloud so you can access from anywhere.</span></span><br /><br />
73
+ <span style="min-height: 50px;"><span class="rg-signup-icon rg-icon-thumb"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/ub-icon.png" style="padding: 0 10px;"></span><span style="width: 90%;"><b>Your Site Promoted in UserBase Rankings -</b> Users vote on your latest content and top ranked posts are promoted on UserBase.com to thousands of people.</span></span><br /><br />
74
+ If you have questions or concerns contact us anytime at <a href="mailto:info@readygraph.com" target="_blank">info@readygraph.com</a> Feel free to check out our <a href="http://readygraph.com/faq/" target="_blank">FAQ</a> for a more comprehensive overview. You can also completely <a class="delete" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("deleteaccount");?>">Delete ReadyGraph</a> if you don't want access to our amazing growth tools. Either way, good luck building a massive userbase!<br/><br/>By connecting to ReadyGraph, you agree to our <a href="http://readygraph.com/tos/" target="_blank">Terms of Service</a> and <a href="http://readygraph.com/privacy/" target="_blank">Privacy Policy</a>.
75
+ </p>
76
+ </div>
77
+ </div>
78
+ </div>
79
  </div>
80
  <div class="authenticating" style="display: none;">
81
  <div style="color: #ffffff; width: 350px; margin: 100px auto 0px; padding: 15px; border: solid 1px #2a388f; text-align: center; background-color: #2961cb; -webkit-border-radius: 7px; -moz-border-radius: 7px; border-radius: 7px;">
82
+ <h3 style="margin-top: 0px; font-weight: 300;"><?php echo $s2_main_plugin_title ?>, Now with ReadyGraph</h3>
83
  <h4 style="padding: 50px 0; line-height: 42px;">Retrieving Your Account..</h4>
84
+ <p>Activate Readygraph features to optimize <?php echo $s2_main_plugin_title ?> functionality. Signup For These Benefits:</p>
85
  <p style="text-align: left; padding: 0 20px;">
86
+ - For qualifying sites, monetize traffic with optimized, non-intrusive ad units<br>
87
  - Grow your subscribers faster<br>
88
  - Engage users with automated email updates<br>
89
  - Enhanced email deliverablility<br>
90
+ - Track performace with user-activity analytics<br>
91
+ - Automatically synchs with your current subscriber list<br>
92
+ - Your best content featured to the full UserBase community<br>
93
  </p>
94
  </div>
95
  </div>
96
+
97
  <div class="authenticated" style="display: none;">
98
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  <?php if(get_option('readygraph_tutorial') && get_option('readygraph_tutorial') == "true"){ ?>
100
  <div class="tutorial-true" style="margin: 5% auto;">
101
+ <h3 style="font-weight: normal; text-align: center;"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/check.png"/>Congratulations! <?php echo $s2_main_plugin_title; ?>'s ReadyGraph growth engine is now active.</h3>
102
+
103
+ <div style="width: 45%; margin: 1% 1% 0 10%; float: left">
104
+ <h3 style="font-weight: normal;color: grey;">Step 1: Choose a plan for exposure to more new users!</h3>
105
+ <div class="rg-icon-thumb"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/round-check.png" class="rg-small-icon"/></div>
106
+ <h4 class="rg-h4">Cross promotion to thousands of users</h4><p class="rg-icon-content">Get promoted through our community emails and your own site SEO page on UserBase.com</p>
107
+ <div class="rg-icon-thumb"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/round-check.png" class="rg-small-icon"/></div>
108
+ <h4 class="rg-h4">Let users vote up your content</h4><p class="rg-icon-content">Add vote buttons in your site post emails. Top voted posts featured on UserBase.com</p>
109
+ <div class="rg-icon-thumb"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/round-check.png" class="rg-small-icon"/></div>
110
+ <h4 class="rg-h4">Content recommendations</h4><p class="rg-icon-content">As a member of our cross promotion network, your users discover valuable content from related sites</p>
111
+ <div class="rg-icon-thumb"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/round-check.png" class="rg-small-icon"/></div>
112
+ <h4 class="rg-h4">Full set of growth tools</h4><p class="rg-icon-content">Optimized signup form, viral invites, site update emails, and more!</p>
113
+ </div>
114
+ <div style="width: 25%; margin: 1% 5% 0 0; float: left; background: #F0F0F0; border-radius: 15px;padding: 1% 2% 1% 1%"><h4 class="rg-h4">Select your plan</h4>
115
+ <div style="margin: 10px;"><div class="rg-icon-thumb"><input type="radio" name="select-plan" value="promote_free" style="font-weight: bold; margin: 12px 0"></div><p class="rg-icon-content"><strong>Free - Stick with the Basic Plan</strong> </input><br><span style="margin-top: -12px">Basic tools, Promotion if content ranks highly</span></p></div>
116
+ <div style="margin: 10px;"><div class="rg-icon-thumb"><input type="radio" name="select-plan" value="promote_39" style="font-weight: bold; margin: 12px 0" checked></div><p class="rg-icon-content"><strong>Get promoted to 2000 users monthly</strong></input><br><span style="margin-top: -12px">$39/month</span></p></div>
117
+ <div style="margin: 10px;"><div class="rg-icon-thumb"><input type="radio" name="select-plan" value="promote_59" style="font-weight: bold; margin: 12px 0"></div><p class="rg-icon-content"><strong>Get promoted to 10,000 users monthly</strong></input><br><span style="margin-top: -12px">$59/month</span></p></div>
118
+ <div style="margin: 10px;"><div class="rg-icon-thumb"><input type="radio" name="select-plan" value="promote_99" style="font-weight: bold; margin: 12px 0"></div><p class="rg-icon-content"><strong>Get promoted to 100,000 users monthly</strong></input><br><span style="margin-top: -12px">$99/month</span></p></div>
119
+ <div style="margin: 10px;"><div class="rg-icon-thumb"><input type="radio" name="select-plan" value="promote_no" style="font-weight: bold; margin: 12px 0"></div><p class="rg-icon-content"><strong>Don't promote my site</strong></input><br><span style="margin-top: -12px">Opt out of cross promotion network</span></p></div>
120
+ <div class="rg-icon-thumb" style="margin: 10px;width:100%"><input type="checkbox" id="plan-type" name="plan-type" value="annual" style="font-weight: bold">&nbsp;&nbsp; Save 20% with an annual plan</input></div>
121
+ <div class="save-changes" style="font-weight: normal; text-align: center;"><a class="btn btn-large btn-warning save-next" href="#" style="margin: 15px" onclick="subscribe_readygraph()">Continue</a><br>
122
  </div></div>
123
  </div>
124
  <?php } else { ?>
125
+
126
+ <div class="tutorial-false" style="margin: 2% auto; width: 90%">
127
  <h3 style="font-weight: normal; text-align: center;">Settings - Make adjustments to grow and engage your userbase</h3>
128
+ <div style="float: left;width: 75%;">
129
+ <div style="display: block;min-height: 250px;">
130
  <div style="width: 45%; margin: 0 auto; float: left;"><h4 class="rg-h4"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/11.png" class="rg-big-icon"/>Email</h4>
131
  <button type="button" class="btn btn-large btn-warning save-next" onclick="window.open('http://readygraph.com/application/customize/settings/advance/');return false;" style="margin: 15px" formtarget="_blank">Automated Email Settings</button>
132
  <button type="button" class="btn btn-large btn-warning save-next" onclick="window.open('http://readygraph.com/application/insights/');return false;" style="margin: 15px"formtarget="_blank">Mass Email Users</button>
141
 
142
  </div>
143
  </div>
144
+ <div style="display: block;min-height: 250px;">
145
  <div style="width: 45%; margin: 0 auto; float: left;"><h4 class="rg-h4"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/7.png" class="rg-big-icon"/>Signup Overlay</h4>
146
  <p>Signup Popup Activated?
147
  <select class="signup-popup" name="signup-popup" class="form-control" onchange="return popup_position(this)">
178
 
179
  </div>
180
  </div>
181
+ </div>
182
+ <div style="width: 23%; display: block; min-height: 200px; float: right;">
183
+ <div class="readygraph_upgrade_right_sidebar">
184
+ <div style="background: #0B3E7F; padding: 5px; color: #fff; "><h4>ReadyGraph Premium</h4></div>
185
+ <p class="centered-image">All the tools you need to grow your audience.<br><br><a href="https://readygraph.com/accounts/payment/?email=<?php echo get_option('readygraph_email', '') ?>" target="_blank" style="color: #b1c1ca" ><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/go-premium.png" height="40px" style="margin:5px" /></a></p>
186
+ </div>
187
+ <div class="readygraph_upgrade_right_sidebar" style="margin-top: 10px;">
188
+ <p class="centered-image">
189
+ <em><strong>Top 3 benefits you can get!</strong></em><br>
190
+ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/7.png" width="50px" style="margin:5px" /><br>
191
+ 1. Promotion to 10,000+ new users/month<br>
192
+ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/11.png" width="50px" style="margin:5px" /><br>
193
+ 2. Unlimited post update emails<br>
194
+ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_fb.png" width="50px" style="margin:5px" /><br>
195
+ 3. Unlimited Facebook invite referrals<br>
196
+
197
+ </p>
198
+ </div>
199
+ </div>
200
  </div>
201
  <?php } ?>
202
  </div>
203
+ </div>
204
  </form>
205
+
206
  <script type="text/javascript" charset="utf-8">
207
+ var enable_monetize;
208
+
209
+
210
+ function subscribe_readygraph() {
211
+ var radios = document.getElementsByName("select-plan");
212
+ if (document.getElementById('plan-type').checked) {
213
+ annual="true";
214
+ } else {
215
+ annual="false";
216
+ }
217
+
218
+ for (var i = 0; i < radios.length; i++) {
219
+ if (radios[i].checked) {
220
+ plan = radios[i].value;
221
+ break;
222
+ }
223
+ }
224
+ var current_url = document.URL;
225
+ var url_array = document.URL.split( '&' );
226
+ url = 'https://readygraph.com/accounts/payment/?email=<?php echo get_option('readygraph_email', '') ?>&payment_plan='+plan+'&is_annual='+annual+'&redirect_uri='+encodeURIComponent(url_array[0]+'&ac=site-profile');
227
+ current_url = url_array[0]+'&ac=site-profile&readygraph_plan='+plan;
228
+ if (plan === "promote_free"){
229
+ window.location.href = current_url;
230
+ }
231
+ else{
232
+ var win=window.open(url, '_blank');
233
+ window.open(current_url, '_self');
234
+ window.location.href = current_url;
235
+ win.focus();
236
+ }
237
+ }
238
  function popup_position(n){
239
  <?php $current_url = explode("&", $_SERVER['REQUEST_URI']); ?>
240
  if(n.selectedIndex === 0){
254
  <?php $current_url = explode("&", $_SERVER['REQUEST_URI']); ?>
255
  window.location.replace("<?php echo $current_url[0].'&popup_delay=';?>"+n.value);
256
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  </script>
258
+
259
+ <?php include("footer.php"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
extension/readygraph/assets/12.png ADDED
Binary file
extension/readygraph/assets/13.png ADDED
Binary file
extension/readygraph/assets/14.png ADDED
Binary file
extension/readygraph/assets/15.png ADDED
Binary file
extension/readygraph/assets/Sign-Alert-icon.png ADDED
Binary file
extension/readygraph/assets/Thumbs.db DELETED
Binary file
extension/readygraph/assets/css/admin.css CHANGED
@@ -33,39 +33,136 @@
33
  padding: 16px 30px;
34
  text-shadow: none;
35
  }
36
- .readygraph-menu {
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  background-color: #093e7d;
39
- color: #34495E;
40
  margin-right: 1%;
41
- height:150px;
42
  margin-bottom: 1%;
43
- padding-top: 1%;
44
-
45
  }
46
- .menu-tabs h4{
47
  color: #b1c1ca;
48
  }
49
- .menu-tabs a:link,a:visited{
50
- color: #5fb1d8;
51
- text-decoration: none;
 
 
 
 
 
 
 
 
52
  }
53
- .menu-tabs a:hover, a:active {
54
- color: #ffffff;
55
- text-decoration: none;
 
 
 
 
 
 
 
 
 
 
56
  }
57
- .menu-tabs {
58
- color: #5fb1d8;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
60
- .alert p {font-style: normal;}
61
-
62
- .alert label {font-size: 14px;font-weight: bold;}
63
 
64
- .wrap1 {width: 100%; display: block; position: relative;}
65
- .save-changes{margin: 15px;}
66
- .rg-signup-icon {float:left; margin:0 1.5em 1em 0}
67
- .menu-tabs {width: 18%; margin: 0 1%; float: left;text-align: center;}
68
- .rg-small-icon { height: 25px; width: 25px; margin: 5px;vertical-align: middle;}
69
- .rg-big-icon { height: 50px; width: 50px; margin: 15px;vertical-align: middle;}
70
- .rg-h4 { font-weight: normal; margin: 0 auto; }
71
- .save-next a, a:hover, a:active, a:visited {text-decoration: none; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  padding: 16px 30px;
34
  text-shadow: none;
35
  }
36
+
37
+ .alert p {font-style: normal;}
38
+
39
+ .alert label {font-size: 14px;font-weight: bold;}
40
+
41
+ .wrap1 {width: 100%; display: block; position: relative;}
42
+ .save-changes{margin: 15px;}
43
+ .rg-small-icon { height: 25px; width: 25px; margin: 5px;vertical-align: middle;}
44
+ .rg-big-icon { height: 50px; width: 50px; margin: 15px;vertical-align: middle;}
45
+ .rg-h4 { font-weight: normal; margin: 0 auto; }
46
+ .save-next a, a:hover, a:active, a:visited {text-decoration: none; }
47
+ .readygraph-nav-menu {
48
 
49
  background-color: #093e7d;
50
+ color: #b1c1ca;
51
  margin-right: 1%;
52
+ height:55px;
53
  margin-bottom: 1%;
54
+ padding-left: 1%;
 
55
  }
56
+ .readygraph-nav-menu h4{
57
  color: #b1c1ca;
58
  }
59
+
60
+ .readygraph-nav-menu ul {
61
+ text-align: left;
62
+ display: inline;
63
+ margin: 0;
64
+ padding: 15px 4px 17px 0;
65
+ list-style: none;
66
+ /* -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
67
+ -moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
68
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);*/
69
+ margin-top: 2px;
70
  }
71
+ .readygraph-nav-menu ul li {
72
+ display: inline-block;
73
+ margin-right: -4px;
74
+ position: relative;
75
+ padding: 15px 30px;
76
+ cursor: pointer;
77
+ -webkit-transition: all 0.2s;
78
+ -moz-transition: all 0.2s;
79
+ -ms-transition: all 0.2s;
80
+ -o-transition: all 0.2s;
81
+ transition: all 0.2s;
82
+ margin-bottom: 0px;
83
+ width: 150px;
84
  }
85
+ .readygraph-nav-menu ul li:hover {
86
+ background: #2691CB;
87
+ color: #fff;
88
+ }
89
+ .readygraph-nav-menu ul li ul {
90
+ padding: 0;
91
+ position: absolute;
92
+ top: 48px;
93
+ left: 0;
94
+ -webkit-box-shadow: none;
95
+ -moz-box-shadow: none;
96
+ box-shadow: none;
97
+ display: none;
98
+ opacity: 0;
99
+ visibility: hidden;
100
+ -webkit-transiton: opacity 0.2s;
101
+ -moz-transition: opacity 0.2s;
102
+ -ms-transition: opacity 0.2s;
103
+ -o-transition: opacity 0.2s;
104
+ -transition: opacity 0.2s;
105
+ background: #2691CB;
106
+ }
107
+ .readygraph-nav-menu ul li ul li {
108
+ display: block;
109
+ margin: 5px;
110
+ width: 140px;
111
+ padding: 10px 0;
112
+ text-align: center;
113
+ }
114
+ .readygraph-nav-menu ul li ul a {
115
+ color: #fff;
116
  }
 
 
 
117
 
118
+ .readygraph-nav-menu ul li ul li:hover{
119
+ background: #fff;
120
+ }
121
+ .readygraph-nav-menu ul li ul li:hover a { color: #2691CB;}
122
+ .readygraph-nav-menu ul li:hover ul {
123
+ display: block;
124
+ opacity: 1;
125
+ visibility: visible;
126
+ }
127
+ .upgrade-notice{
128
+ text-align: center;
129
+ width: 60%;
130
+ margin: 1% auto;
131
+ background: #E1EFD4;
132
+ border: 1px solid #BFDBA7;
133
+ }
134
+ .upgrade-notice-text{
135
+ margin: 2% 5%;
136
+ }
137
+ .aa_close {
138
+ float: right;
139
+ }
140
+ .readygraph_upgrade_right_sidebar{
141
+ border: 1px solid #BAD6DA;
142
+ width: 100%;
143
+ text-align: center;
144
+ }
145
+ .centered-image {
146
+ padding:15px;
147
+ }
148
+ .rg-three-column {
149
+ width: 29%;
150
+ margin: 1% 2% 1%;
151
+ border: 2px solid #2691CB;
152
+ }
153
+ .rg-signup-icon{
154
+ margin: 0 15px 0 5px;
155
+ clear:both;
156
+ }
157
+ .rg-icon-thumb {
158
+ float: left;
159
+ }
160
+ .rg-icon-thumb img {
161
+ display: block;
162
+ }
163
+ .rg-icon-content {
164
+ margin-left: 25px;
165
+ }
166
+ .site_category select{
167
+ margin: 5px;
168
+ }
extension/readygraph/assets/css/upgrade.css ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Bootstrap v3.1.1 (http://getbootstrap.com)
3
+ * Copyright 2011-2014 Twitter, Inc.
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5
+ */
6
+
7
+ .rg_message{
8
+ background-size: 40px 40px;
9
+ background-image: linear-gradient(135deg, rgba(255, 255, 255, .05) 25%, transparent 25%,
10
+ transparent 50%, rgba(255, 255, 255, .05) 50%, rgba(255, 255, 255, .05) 75%,
11
+ transparent 75%, transparent);
12
+ box-shadow: inset 0 -1px 0 rgba(255,255,255,.4);
13
+ width: 98%;
14
+ border: 1px solid;
15
+ color: #fff;
16
+ padding: 15px;
17
+ text-shadow: 0 1px 0 rgba(0,0,0,.5);
18
+ animation: animate-bg 5s linear infinite;
19
+ border-radius: 5px;
20
+ }
21
+
22
+ .rg_info{
23
+ background-color: #4ea5cd;
24
+ border-color: #3b8eb5;
25
+ }
26
+
27
+ .rg_error{
28
+ background-color: #de4343;
29
+ border-color: #c43d3d;
30
+ }
31
+
32
+ .rg_warning{
33
+ background-color: #eaaf51;
34
+ border-color: #d99a36;
35
+ }
36
+
37
+ .rg_success{
38
+ background-color: #61b832;
39
+ border-color: #55a12c;
40
+ }
41
+
42
+ .rg_message h3{
43
+ margin: 0 0 5px 0;
44
+ }
45
+
46
+ .rg_message p{
47
+ margin: 0;
48
+ }
49
+
50
+ @keyframes animate-bg {
51
+ from {
52
+ background-position: 0 0;
53
+ }
54
+ to {
55
+ background-position: -80px 0;
56
+ }
57
+ }
58
+ .aa_close {
59
+ position: absolute;
60
+ right: 18px;
61
+ top: 18px;
62
+ }
63
+ .pure-button{display:inline-block;*display:inline;zoom:1;line-height:normal;white-space:nowrap;vertical-align:baseline;text-align:center;cursor:pointer;-webkit-user-drag:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.pure-button::-moz-focus-inner{padding:0;border:0}.pure-button{font-family:inherit;font-size:100%;*font-size:90%;*overflow:visible;padding:1em 1em;color:#444;color:rgba(0,0,0,.8);*color:#444;border:1px solid #999;border:0 rgba(0,0,0,0);background-color:#E6E6E6;text-decoration:none;border-radius:2px}.pure-button-hover,.pure-button:hover,.pure-button:focus{filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#1a000000', GradientType=0);background-image:-webkit-gradient(linear,0 0,0 100%,from(transparent),color-stop(40%,rgba(0,0,0,.05)),to(rgba(0,0,0,.1)));background-image:-webkit-linear-gradient(transparent,rgba(0,0,0,.05) 40%,rgba(0,0,0,.1));background-image:-moz-linear-gradient(top,rgba(0,0,0,.05) 0,rgba(0,0,0,.1));background-image:-o-linear-gradient(transparent,rgba(0,0,0,.05) 40%,rgba(0,0,0,.1));background-image:linear-gradient(transparent,rgba(0,0,0,.05) 40%,rgba(0,0,0,.1))}.pure-button:focus{outline:0}.pure-button-active,.pure-button:active{box-shadow:0 0 0 1px rgba(0,0,0,.15) inset,0 0 6px rgba(0,0,0,.2) inset}.pure-button[disabled],.pure-button-disabled,.pure-button-disabled:hover,.pure-button-disabled:focus,.pure-button-disabled:active{border:0;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);filter:alpha(opacity=40);-khtml-opacity:.4;-moz-opacity:.4;opacity:.4;cursor:not-allowed;box-shadow:none}.pure-button-hidden{display:none}.pure-button::-moz-focus-inner{padding:0;border:0}.pure-button-primary,.pure-button-selected,a.pure-button-primary,a.pure-button-selected{background-color:#0078e7;color:#fff}
64
+ .button-warning {
65
+ color: white;
66
+ border-radius: 4px;
67
+ text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
68
+ background: rgb(223, 117, 20);
69
+ }
extension/readygraph/assets/go-premium.png ADDED
Binary file
extension/readygraph/assets/icon_currency.png ADDED
Binary file
extension/readygraph/assets/js/jquery.dependent-selects.js ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Generated by CoffeeScript 1.6.3
2
+ /*
3
+ # jQuery Dependent Selects v1.2.2
4
+ # Copyright 2012 Mark J Smith, Simpleweb
5
+ # Details on http://github.com/simpleweb/jquery-dependent-selects
6
+ */
7
+
8
+ (function($) {
9
+ return $.fn.dependentSelects = function(options) {
10
+ var clearAllSelectsByParent, createNewSelect, createSelectId, findSelectParent, hideSelect, insertLabel, insertPlaceholderSelect, labelAtDepth, placeholderOptionAtDepth, placeholderSelectAtDepth, prepareSelect, selectChange, selectPreSelected, selectedOption, showSelect, splitOptionName;
11
+ if (options == null) {
12
+ options = {};
13
+ }
14
+ options = $.extend({
15
+ 'separator': ' > ',
16
+ 'placeholderOption': '',
17
+ 'placeholderSelect': false,
18
+ 'class': false,
19
+ 'labels': false
20
+ }, options);
21
+ createSelectId = function() {
22
+ var int;
23
+ int = parseInt(Math.random() * 1000);
24
+ if ($("[data-dependent-id='" + int + "']").length > 0) {
25
+ return createSelectId();
26
+ } else {
27
+ return int;
28
+ }
29
+ };
30
+ splitOptionName = function($option) {
31
+ var array, i, item, _i, _len;
32
+ array = $.map($option.text().split(options.separator), function(valuePart) {
33
+ return $.trim(valuePart);
34
+ });
35
+ i = 0;
36
+ for (_i = 0, _len = array.length; _i < _len; _i++) {
37
+ item = array[_i];
38
+ if (item === '') {
39
+ array.splice(i, 1);
40
+ i--;
41
+ }
42
+ i++;
43
+ }
44
+ return array;
45
+ };
46
+ placeholderSelectAtDepth = function(depth, $select) {
47
+ var placeholder, text;
48
+ depth--;
49
+ placeholder = options.placeholderSelect;
50
+ if (placeholder) {
51
+ if (placeholder === true) {
52
+ placeholder = $select.data('dependent-select-placeholders');
53
+ }
54
+ if (typeof placeholder === 'object') {
55
+ if (placeholder[depth]) {
56
+ text = placeholder[depth];
57
+ } else {
58
+ text = placeholder[placeholder.length - 1];
59
+ }
60
+ } else {
61
+ text = placeholder;
62
+ }
63
+ return $("<select disabled><option>" + text + "</option></select>").attr({
64
+ 'data-dependent-depth': depth + 1,
65
+ 'data-dependent-placeholder': true,
66
+ 'data-dependent-id': $select.attr('data-dependent-id')
67
+ });
68
+ }
69
+ };
70
+ placeholderOptionAtDepth = function(depth) {
71
+ var placeholder, text;
72
+ depth--;
73
+ placeholder = options.placeholderOption;
74
+ if (typeof placeholder === 'object') {
75
+ if (placeholder[depth]) {
76
+ text = placeholder[depth];
77
+ } else {
78
+ text = placeholder[placeholder.length - 1];
79
+ }
80
+ } else {
81
+ text = placeholder;
82
+ }
83
+ return $("<option>" + text + "</option>");
84
+ };
85
+ labelAtDepth = function(depth, $select) {
86
+ var labels;
87
+ depth--;
88
+ labels = options.labels;
89
+ if (labels) {
90
+ if (labels === true) {
91
+ labels = $select.data('dependent-labels');
92
+ }
93
+ if (labels[depth]) {
94
+ return labels[depth];
95
+ } else {
96
+ return labels[labels.length - 1];
97
+ }
98
+ } else {
99
+ return false;
100
+ }
101
+ };
102
+ hideSelect = function($select) {
103
+ var label, placeholder_select, select_depth, select_id;
104
+ select_id = $select.attr('data-dependent-id');
105
+ select_depth = $select.attr('data-dependent-depth');
106
+ placeholder_select = $("select[data-dependent-placeholder][data-dependent-id='" + select_id + "'][data-dependent-depth='" + select_depth + "']");
107
+ label = $("label[data-dependent-id='" + select_id + "'][data-dependent-depth='" + select_depth + "']").hide();
108
+ if (placeholder_select.length > 0) {
109
+ placeholder_select.show();
110
+ label.show();
111
+ }
112
+ return $select.hide();
113
+ };
114
+ showSelect = function($select) {
115
+ var label, placeholder_select, select_depth, select_id;
116
+ select_id = $select.attr('data-dependent-id');
117
+ select_depth = $select.attr('data-dependent-depth');
118
+ placeholder_select = $("select[data-dependent-placeholder][data-dependent-id='" + select_id + "'][data-dependent-depth='" + select_depth + "']");
119
+ label = $("label[data-dependent-id='" + select_id + "'][data-dependent-depth='" + select_depth + "']").show();
120
+ if (placeholder_select.length > 0) {
121
+ placeholder_select.hide();
122
+ }
123
+ return $select.show();
124
+ };
125
+ insertLabel = function($select, $parent) {
126
+ var $label, label, select_depth, select_id;
127
+ if (label = labelAtDepth($select.attr('data-dependent-depth'), $select)) {
128
+ select_id = $select.attr('data-dependent-id');
129
+ select_depth = $select.attr('data-dependent-depth');
130
+ $label = $("<label>" + label + "</label>").attr({
131
+ 'data-dependent-id': select_id,
132
+ 'data-dependent-depth': select_depth
133
+ });
134
+ if (!($("label[data-dependent-id='" + select_id + "'][data-dependent-depth='" + select_depth + "']").length > 0)) {
135
+ if ($parent) {
136
+ return $parent.after($label);
137
+ } else {
138
+ return $select.before($label);
139
+ }
140
+ }
141
+ }
142
+ };
143
+ insertPlaceholderSelect = function($select, $parent) {
144
+ var $placeholderSelect, depth, select_id;
145
+ if ($placeholderSelect = placeholderSelectAtDepth($select.attr('data-dependent-depth'), $select)) {
146
+ select_id = $select.attr('data-dependent-id');
147
+ depth = $select.attr('data-dependent-depth');
148
+ if (!($("select[data-dependent-placeholder][data-dependent-id='" + select_id + "'][data-dependent-depth='" + depth + "']").length > 0)) {
149
+ return $select.before($placeholderSelect);
150
+ }
151
+ }
152
+ };
153
+ clearAllSelectsByParent = function($parent) {
154
+ return $(".dependent-sub[data-dependent-id='" + ($parent.attr('data-dependent-id')) + "']").each(function() {
155
+ if (parseInt($(this).attr('data-dependent-depth')) > parseInt($parent.attr('data-dependent-depth'))) {
156
+ $(this).find('option:first').attr('selected', 'selected');
157
+ return hideSelect($(this));
158
+ }
159
+ });
160
+ };
161
+ createNewSelect = function(name, $select, depth) {
162
+ var $currentSelect, $labels, $newSelect, select_id;
163
+ select_id = $select.attr('data-dependent-id');
164
+ if (($currentSelect = $("select[data-dependent-parent='" + name + "'][data-dependent-id='" + select_id + "']")).length > 0) {
165
+ return $currentSelect;
166
+ }
167
+ $newSelect = $('<select class="dependent-sub"/>').attr('data-dependent-parent', name).attr('data-dependent-depth', depth).attr('data-dependent-input-name', $select.attr('data-dependent-input-name')).attr('data-dependent-id', select_id).addClass(options["class"]).append(placeholderOptionAtDepth(depth));
168
+ if (options.labels === true) {
169
+ $newSelect.attr('data-dependent-labels', $select.attr('data-dependent-labels'));
170
+ }
171
+ if (options.placeholderSelect === true) {
172
+ $newSelect.attr('data-dependent-select-placeholders', $select.attr('data-dependent-select-placeholders'));
173
+ }
174
+ if (($labels = $("label[data-dependent-id='" + select_id + "'][data-dependent-depth='" + depth + "']")).length > 0) {
175
+ $newSelect.insertAfter($labels);
176
+ } else {
177
+ $newSelect.insertAfter($select);
178
+ }
179
+ insertLabel($newSelect, $select);
180
+ insertPlaceholderSelect($newSelect, $select);
181
+ return hideSelect($newSelect);
182
+ };
183
+ selectChange = function($select) {
184
+ var $sub, select_id, val, valName;
185
+ $("select[data-dependent-id='" + ($select.attr('data-dependent-id')) + "'][name]").removeAttr('name');
186
+ valName = $select.find(':selected').html();
187
+ val = $select.val();
188
+ select_id = $select.attr('data-dependent-id');
189
+ clearAllSelectsByParent($select);
190
+ if (($sub = $(".dependent-sub[data-dependent-parent='" + valName + "'][data-dependent-id='" + select_id + "']")).length > 0) {
191
+ showSelect($sub);
192
+ return $sub.attr('name', $select.attr('data-dependent-input-name'));
193
+ } else {
194
+ return $select.attr('name', $select.attr('data-dependent-input-name'));
195
+ }
196
+ };
197
+ selectedOption = function($select) {
198
+ var $selectedOption, val;
199
+ $selectedOption = $select.find('option:selected');
200
+ val = $selectedOption.val();
201
+ if (!(val === '' || val === placeholderOptionAtDepth($select.attr('data-dependent-depth')).val())) {
202
+ return $select.attr('data-dependent-selected-id', val);
203
+ }
204
+ };
205
+ findSelectParent = function($select) {
206
+ var $all_options, $selects;
207
+ $selects = $("select[data-dependent-id='" + ($select.attr('data-dependent-id')) + "']");
208
+ $all_options = $selects.find('option');
209
+ return $selects.filter(function() {
210
+ var vals;
211
+ vals = [];
212
+ $(this).find('option').each(function() {
213
+ return vals.push($(this).html() === $select.attr('data-dependent-parent'));
214
+ });
215
+ return $.inArray(true, vals) > -1;
216
+ });
217
+ };
218
+ selectPreSelected = function($select) {
219
+ var $all_options, $current_select, $selected_option, $selected_select, $selects, current_option_text, i, selected_id, _i, _ref;
220
+ if ((selected_id = $select.attr('data-dependent-selected-id'))) {
221
+ $selects = $("select[data-dependent-id='" + ($select.attr('data-dependent-id')) + "']");
222
+ $all_options = $selects.find('option');
223
+ $selected_option = $all_options.filter("[value='" + selected_id + "']");
224
+ $selected_select = $selected_option.closest('select');
225
+ $current_select = $selected_select;
226
+ current_option_text = $selected_option.html();
227
+ for (i = _i = _ref = parseInt($selected_select.attr('data-dependent-depth')); _ref <= 0 ? _i <= 0 : _i >= 0; i = _ref <= 0 ? ++_i : --_i) {
228
+ $current_select.find('option').each(function() {
229
+ if ($(this).html() === current_option_text) {
230
+ return $(this).attr('selected', 'selected');
231
+ } else {
232
+ return $(this).removeAttr('selected');
233
+ }
234
+ });
235
+ showSelect($current_select);
236
+ current_option_text = $current_select.attr('data-dependent-parent');
237
+ $current_select = findSelectParent($current_select);
238
+ }
239
+ return $selected_select.trigger('change');
240
+ }
241
+ };
242
+ prepareSelect = function($select, depth, select_id) {
243
+ var $options, name;
244
+ $select.attr('data-dependent-depth', depth).attr('data-dependent-id', select_id);
245
+ $options = $select.children('option');
246
+ $options.each(function() {
247
+ var $newOption, $option, $subSelect, name, val;
248
+ $option = $(this);
249
+ name = splitOptionName($option);
250
+ val = $option.val();
251
+ if (name.length > 1) {
252
+ $subSelect = createNewSelect(name[0], $select, depth + 1);
253
+ $newOption = $option.clone();
254
+ $newOption.html($.trim(splitOptionName($newOption).slice(1).join(options.separator)));
255
+ $subSelect.append($newOption);
256
+ $option.val('').html(name[0]).attr('data-dependent-name', name[0]);
257
+ if ($options.parent().find("[data-dependent-name='" + name[0] + "']").length > 1) {
258
+ $option.remove();
259
+ }
260
+ return prepareSelect($subSelect, depth + 1, select_id);
261
+ }
262
+ });
263
+ name = $select.attr('name');
264
+ selectChange($select);
265
+ return $select.off('change').on('change', function() {
266
+ return selectChange($select);
267
+ });
268
+ };
269
+ return this.each(function() {
270
+ var $select;
271
+ $select = $(this);
272
+ $select.attr('data-dependent-input-name', $select.attr('name'));
273
+ selectedOption($select);
274
+ prepareSelect($select, 0, createSelectId());
275
+ return selectPreSelected($select);
276
+ });
277
+ };
278
+ })(jQuery);
extension/readygraph/assets/round-check.png ADDED
Binary file
extension/readygraph/assets/ub-icon.png ADDED
Binary file
extension/readygraph/customize-emails.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Represents the view for the administration dashboard.
4
  *
@@ -11,23 +12,8 @@
11
  * @link http://www.readygraph.com
12
  * @copyright 2014 Your Name or Company Name
13
  */
14
-
15
- function s2_disconnectReadyGraph(){
16
- $app_id = get_option('readygraph_application_id');
17
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=disconnect_readygraph&app_id=$app_id" );
18
- s2_delete_rg_options();
19
- }
20
- function s2_deleteReadyGraph(){
21
- $app_id = get_option('readygraph_application_id');
22
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=uninstall_readygraph&app_id=$app_id" );
23
- s2_delete_rg_options();
24
- $dir = plugin_dir_path( __FILE__ );
25
- s2_rrmdir($dir);
26
- }
27
 
28
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "changeaccount")s2_disconnectReadyGraph();
29
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "deleteaccount")s2_deleteReadyGraph();
30
- global $main_plugin_title;
31
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
32
  //redirect to main page
33
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
@@ -45,123 +31,11 @@ s2_rrmdir($dir);
45
  }
46
  ?>
47
 
48
- <link rel="stylesheet" type="text/css" href="<?php echo plugins_url( 'assets/css/admin.css', __FILE__ ) ?>">
49
- <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/admin.js', __FILE__ ) ?>"></script>
50
  <form method="post" id="myForm">
51
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
52
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
53
  <input type="hidden" name="readygraph_email" value="<?php echo get_option('readygraph_email', '') ?>">
54
  <input type="hidden" name="readygraph_application_id" value="<?php echo get_option('readygraph_application_id', '') ?>">
55
-
56
- <div class="authenticate" style="display: none;">
57
- <div class="wrap1" style="min-height: 600px;">
58
-
59
- <div id="icon-plugins" class="icon32"></div>
60
- <h2>We've enhanced <?php echo $main_plugin_title ?> with ReadyGraph's User Growth Engine</h2>
61
-
62
- <p style="display:none;color:red;" id="error"></p>
63
- <div class="register-left">
64
- <div class="alert" style="margin: 0px auto; padding: 15px; text-align: center;">
65
- <h3>Activate ReadyGraph to get more traffic to your site</h3>
66
- <!-- <h3 style="margin-top: 0px; font-weight: 300;"><?php //echo $main_plugin_title ?>, Now with ReadyGraph</h3> -->
67
- <p style="padding: 50px 0px 30px 0px;"><a class="btn btn-primary connect" href="javascript:void(0);" style="font-size: 15px; line-height: 40px; padding: 0 30px;">Connect ReadyGraph</a></p>
68
- <!--<p style="padding: 0px 0px;"><a class="btn btn-default skip" href="javascript:void(0);" style="font-size: 10px; line-height: 20px; padding: 0 30px;">Skip ReadyGraph</a></p>-->
69
- <p>Readygraph adds more ways to connect to your users. </p>
70
- <p style="text-align: left; padding: 0 20px;">
71
- - Get more traffic<br>
72
- - Send automatic email digests of all your site posts<br>
73
- - Get better deliverablility<br>
74
- - Track performace and user activity
75
- </p>
76
- </div>
77
-
78
- </div>
79
-
80
- <div class="register-right">
81
- <div class="form-wrap alert" style="font-size:12px;">
82
- <p><h3>ReadyGraph grows your site</h3></p>
83
- <p>ReadyGraph delivers audience growth and motivates users to come back.</p><br /><p><span class="rg-signup-icon"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_fb.png"></span><b>Optimized Signup Form –</b> ReadyGraph’s signup form has one click signup and integration with Facebook so you can get quick and easy signups from your users.<br /><br /><span class="rg-signup-icon"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_heart.png"></span>
84
- <b>Viral Friend Invites –</b>Loyal site visitors who love your site can easily invite all their friends. Readygraph encourages your visitors' friends to come and signup for your site too.<br /><br /><b><span class="rg-signup-icon"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_mail.png"></span>Automated Re-engagement Emails –</b> ReadyGraph’s automated emails keep visitors coming back. Send a daily or weekly digest of all your new posts and keep them informed about site activity, events, etc.<br /><br /><b><span class="rg-signup-icon"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_chart.png"></span>Analytics -</b> Track new subscribers, invites, traffic, and other key metrics that quantify growth and user engagement. ReadyGraph safely stores user data on the cloud so you can access from anywhere.<br /><br />
85
- If you have questions or concerns contact us anytime at <a href="mailto:info@readygraph.com" target="_blank">info@readygraph.com</a></p>
86
- </div>
87
- </div>
88
- </div>
89
- </div>
90
- <div class="authenticating" style="display: none;">
91
- <div style="color: #ffffff; width: 350px; margin: 100px auto 0px; padding: 15px; border: solid 1px #2a388f; text-align: center; background-color: #2961cb; -webkit-border-radius: 7px; -moz-border-radius: 7px; border-radius: 7px;">
92
- <h3 style="margin-top: 0px; font-weight: 300;"><?php echo $main_plugin_title ?>, Now with ReadyGraph</h3>
93
- <h4 style="padding: 50px 0; line-height: 42px;">Retrieving Your Account..</h4>
94
- <p>Activate Readygraph features to optimize <?php echo $main_plugin_title ?> functionality. Signup For These Benefits:</p>
95
- <p style="text-align: left; padding: 0 20px;">
96
- - Grow your subscribers faster<br>
97
- - Engage users with automated email updates<br>
98
- - Enhanced email deliverablility<br>
99
- - Track performace with user-activity analytics
100
- </p>
101
- </div>
102
- </div>
103
- <style>a.help-tooltip {outline:none; }a.help-tooltip strong {line-height:30px;}a.help-tooltip:hover {text-decoration:none;} a.help-tooltip span { z-index:10;display:none; padding:14px 20px; margin-top:40px; margin-left:-150px; width:300px; line-height:16px;}a.help-tooltip:hover span{ display:inline; position:absolute; border:2px solid #FFF; background:#fff; text-align: justify; z-index:1000000000;}.callout {z-index:1000000000;position:absolute;border:0;top:-14px;left:120px;} /*CSS3 extras*/a.help-tooltip span{ border-radius:2px; -moz-border-radius: 2px; -webkit-border-radius: 2px; -moz-box-shadow: 0px 0px 8px 4px #666; -webkit-box-shadow: 0px 0px 8px 4px #666; box-shadow: 0px 0px 8px 4px #666;}</style>
104
- <div class="authenticated" style="display: none;">
105
- <div style="background-color: #2961cb; min-width: 90%; height: 50px;margin-right: 1%;">
106
- <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/white-logo.png" style="width: 138px; height: 30px; margin: 10px 0 0 15px; float: left;">
107
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
108
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
109
- <span class="email-address" style="text-shadow: none;"></span> <span class="caret"></span>
110
- </button>
111
- <ul class="dropdown-menu">
112
- <li><a class="change-account" href="#">Change Account</a></li>
113
- <li><a class="disconnect" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("changeaccount");?>">Disconnect</a></li>
114
- <li><a class="delete" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("deleteaccount");?>">Delete ReadyGraph</a></li>
115
- </ul>
116
- </div>
117
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
118
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
119
- <span class="result" style="text-shadow: none;">...</span> <span class="caret"></span>
120
- </button>
121
- <ul class="dropdown-menu">
122
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Insights</a></li>
123
- </ul>
124
- </div>
125
- <div style="clear: both;"></div>
126
- </div>
127
- <!-- write menu code-->
128
- <div class="readygraph-menu">
129
- <div class="menu-tabs"><h4>Grow Users</h4>
130
- <ul>
131
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
132
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
133
- <li><a href="#"></a></li>
134
- </ul>
135
- </div>
136
- <div class="menu-tabs"><h4>Email Users</h4>
137
- <ul>
138
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
139
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
140
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
141
- </ul>
142
- </div>
143
- <div class="menu-tabs"><h4>Engage Users</h4>
144
- <ul>
145
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed">Social Feed</a></li>
146
- <li><a href="#">Social Followers</a></li>
147
- <li><a href="#">Feedback Survey</a></li>
148
- </ul>
149
- </div>
150
- <div class="menu-tabs"><h4>Basic Settings</h4>
151
- <ul>
152
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
153
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=feature-settings">Feature Settings</a></li>
154
-
155
- </ul>
156
- </div>
157
- <div class="menu-tabs" style="float:right"><h4>&nbsp;</h4>
158
- <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
159
- <p>
160
- <a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=faq" style="color: #b1c1ca" >FAQ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/10.png" /></a></p>
161
-
162
- </ul>
163
- </div>
164
- </div>
165
  <div class="tutorial-true" style="margin: 5% auto;">
166
  <h3 style="font-weight: normal; text-align: center;">Next Step: Customize automated emails to engage your userbase</h3>
167
  <h4 style="font-weight: normal; text-align: center;">Head over to ReadyGraph.com to customize emails such as:</h4>
@@ -175,378 +49,6 @@ If you have questions or concerns contact us anytime at <a href="mailto:info@rea
175
  <a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=basic-settings" style="margin: 15px">Skip, End Tutorial</a>
176
  </div></div>
177
  </div>
178
-
179
- </div>
180
- </form>
181
- <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
182
- <script type="text/javascript" charset="utf-8">
183
- var $ = jQuery;
184
- $(function () {
185
- var settings =
186
- {
187
- 'host': "www.readygraph.com"
188
- , 'clientId': "9838eb84c6da2fc44ab9"
189
- };
190
 
191
- var authHost = "https://" + settings.host;
192
- var resourceHost = "https://" + settings.host;
193
-
194
- // OAuth 2.0 Popup
195
- //
196
- var popupWindow=null;
197
- function openPopup(url)
198
- {
199
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
200
- else popupWindow = window.open(url,"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=515, height=330,top=" + (screen.height - 330)/2 + ",left=" + (screen.width - 515)/2);
201
- }
202
- function parent_disable() {
203
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
204
- }
205
-
206
- $("a.connect").click(function() {
207
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
208
- openPopup(url);
209
- $(document.body).bind('focus', parent_disable);
210
- $(document.body).bind('click', parent_disable);
211
- });
212
- $(".change-account").click(function() {
213
- document.cookie="readygraph_tutorial=true"
214
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
215
- var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
216
- openPopup(logout);
217
- $(document.body).bind('focus', parent_disable);
218
- $(document.body).bind('click', parent_disable);
219
- });
220
-
221
- // User Interface
222
- //
223
- $('.template').click(function() {
224
- $('#preview').attr('src', $(this).find('img').attr('src'));
225
- });
226
-
227
- // Manage OAuth 2.0 Redirect
228
- //
229
- var extractCode = function(hash) {
230
- var match = hash.match(/code=(\w+)/);
231
- return !!match && match[1];
232
- };
233
- var extractToken = function(hash) {
234
- var match = hash.match(/access_token=(\w+)/);
235
- return !!match && match[1];
236
- };
237
- var extractError = function(hash) {
238
- var match = hash.match(/error=(\w+)/);
239
- return !!match && match[1];
240
- };
241
-
242
- var code = extractCode(window.location.href);
243
- if (extractError(window.location.href) == 'access_denied') {
244
- window.close();
245
- }
246
- else if(code) {
247
- try { window.opener.setCode(code); }
248
- catch(ex) { }
249
- window.close();
250
- }
251
- else {
252
- $('.rgw-fb-login-button-iframe').hide();
253
- $('div.authenticate').show();
254
-
255
- if ($('[name="readygraph_access_token"]').val()) {
256
- $('.rgw-fb-login-button-iframe').show();
257
- $('div.authenticate').hide();
258
- $('div.authenticating').hide();
259
- $('div.authenticated').show();
260
-
261
- $('.email-address').text($('[name="readygraph_email"]').val());
262
-
263
- window.setup_readygraph($('[name="readygraph_application_id"]').val());
264
- $('.delay').val($('[name="readygraph_delay"]').val());
265
- $('.sidebar').val($('[name="readygraph_enable_sidebar"]').val());
266
- $('.notification').val($('[name="readygraph_enable_notification"]').val());
267
- $('.selectAll').val($('[name="readygraph_auto_select_all"]').val());
268
- $('.branding').val($('[name="readygraph_enable_branding"]').val());
269
- $('.blog_updates').val($('[name="readygraph_send_blog_updates"]').val());
270
- $('.real_time_post_update').val($('[name="readygraph_send_real_time_post_updates"]').val());
271
- $('.popup_template').val($('[name="readygraph_popup_template"]').val());
272
-
273
- //$('[name="readygraph_ad_format"][value="' + $('[name="_readygraph_ad_format"]').val() + '"]').parent().click();
274
- //$('[name="readygraph_ad_timing"][value="' + $('[name="_readygraph_ad_timing"]').val() + '"]').parent().click();
275
-
276
- //$('[name="readygraph_ad_delay"]').val($('[name="_readygraph_ad_delay"]').val());
277
- //$('[name="readygraph_ad_scroll"]').val($('[name="_readygraph_ad_scroll"]').val());
278
-
279
- $('.result').text('...');
280
- if ($('[name="readygraph_access_token"]').val()) {
281
- $.ajax({
282
- url: resourceHost + '/api/v1/insight_info'
283
- , beforeSend: function (xhr) {
284
- xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
285
- xhr.setRequestHeader('Accept', "application/json");
286
- }
287
- , method: 'POST'
288
- , success: function (response) {
289
- if (response.data) {
290
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
291
- } else {
292
- $('.result').text('Insight');
293
- }
294
- }
295
- , error: function (response) {
296
- refresh_access_token();
297
- }
298
- });
299
- }
300
- }
301
- }
302
-
303
- // Manage OAuth 2.0 Results
304
- //
305
- function refresh_access_token() {
306
- var refresh_token = $('[name="readygraph_refresh_token"]').val();
307
- if (refresh_token) {
308
- $('div.authenticate').hide();
309
- $('div.authenticating').show();
310
- $('div.authenticated').hide();
311
-
312
- $.ajax({
313
- url: resourceHost + '/oauth/access_token'
314
- , data: {
315
- grant_type: 'refresh_token',
316
- refresh_token: $('[name="readygraph_refresh_token"]').val(),
317
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
318
- client_id: settings.clientId
319
- }
320
- , method: 'POST'
321
- , success: function (response) {
322
- $('[name="readygraph_access_token"]').val(response.access_token);
323
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
324
- window.setAccessToken(response.access_token);
325
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
326
- }
327
- , error: function (response) {
328
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
329
- $('div.authenticate').show();
330
- $('div.authenticating').hide();
331
- $('div.authenticated').hide();
332
- }
333
- });
334
- }
335
- }
336
- window.setCode = function(code) {
337
- $('.rgw-fb-login-button-iframe').hide();
338
- $('div.authenticate').hide();
339
- $('div.authenticating').show();
340
- $('div.authenticated').hide();
341
-
342
- $.ajax({
343
- url: resourceHost + '/oauth/access_token'
344
- , data: {
345
- grant_type: 'authorization_code',
346
- code: code,
347
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
348
- client_id: settings.clientId
349
- }
350
- , method: 'POST'
351
- , success: function (response) {
352
- if (response) {
353
- $('[name="readygraph_access_token"]').val(response.access_token);
354
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
355
- window.setAccessToken(response.access_token);
356
- } else {
357
- $('div.authenticating').hide();
358
- $('div.authenticate').show();
359
- }
360
- }
361
- });
362
- }
363
- window.setAccessToken = function(token) {
364
- $('.rgw-fb-login-button-iframe').hide();
365
- $('div.authenticate').hide();
366
- $('div.authenticating').show();
367
- $('div.authenticated').hide();
368
-
369
- $.ajax({
370
- url: resourceHost + '/api/v1/account_info'
371
- , beforeSend: function (xhr) {
372
- xhr.setRequestHeader('Authorization', "Bearer " + token);
373
- xhr.setRequestHeader('Accept', "application/json");
374
- }
375
- , method: 'POST'
376
- , success: function (response) {
377
- if (response.data) {
378
- $('[name="readygraph_access_token"]').val(token);
379
- $('[name="readygraph_email"]').val(response.data.email);
380
- $('[name="readygraph_application_id"]').val(response.data.application_id);
381
- $('#myForm')[0].submit();
382
- } else {
383
- $('div.authenticating').hide();
384
- $('div.authenticate').show();
385
- $('.rgw-fb-login-button-iframe').hide();
386
- }
387
- }
388
- });
389
- }
390
- });
391
- </script>
392
- <script>
393
- window.setup = false;
394
- window.refresh_readygraph = function() {};
395
- window.setup_readygraph = function(app_id) {
396
- if (window.setup) {
397
- window.refresh_readygraph();
398
- return;
399
- }
400
- window.setup = true;
401
- readygraph.setup({
402
- applicationId: app_id,
403
- isPreview: true,
404
- enableLoginWall: false,
405
- enableDistraction: false,
406
- enableAutoLogin: false,
407
- enableSidebar: false,
408
- enableNotification: false,
409
- enableInvite: false,
410
- enableOpenGraph: false,
411
- enableRgSeo: false
412
- });
413
- readygraph.ready(function() {
414
- readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
415
- var $ = readygraph.framework.jQuery;
416
- $.cookie('RGAuth', null);
417
- readygraph.framework.facebook.logout(function() {
418
- readygraph.framework.require(['invite'], function() {
419
- var VIEW_TYPE = {
420
- LOADING: 0,
421
- LOGIN_REQUIRE: 1,
422
- PERMISSION_REQUIRE: 2,
423
- DEFAULT: 3,
424
- LOGIN_WITH_EMAIL: 4,
425
- SIGNUP_WITH_EMAIL: 5,
426
- IMPORT_WITH_EMAIL: 6,
427
- FINISH: 10
428
- };
429
-
430
- var auth = new readygraph.framework.ui.AuthModel({
431
- dialog: true,
432
- 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
433
- });
434
- $('.rg-preview-widget').html('');
435
- $('.rg-preview-widget').append(auth.lightbox.view.$el);
436
- $('.rgw-content').attr('style', 'position: relative !important;');
437
-
438
- var view = VIEW_TYPE.LOGIN_REQUIRE;
439
- auth.on('switch', function() {
440
- if (auth.view.currentView != view) { auth.view.switchView(view); }
441
- else auth.view.render();
442
- if (view == VIEW_TYPE.DEFAULT) {
443
- auth.view.$el.find('.rgw-invite-view').showAndAnimate();
444
- auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
445
- auth.view.$el.commitTransition();
446
- }
447
- });
448
- auth.view.switchView(view);
449
-
450
- $(window).scroll(function() {
451
- $(window).trigger('rgw-invalidate');
452
- });
453
- $('.rg-preview-widget, .content-warp').scroll(function() {
454
- $(window).trigger('rgw-invalidate');
455
- });
456
- $(window).trigger('rgw-invalidate');
457
-
458
- $('.rg-vertical-tab').click(function() {
459
- saveContent(auth, $('.rg-preview-widget-container'), true);
460
-
461
- $('.rg-vertical-tab').removeClass('active');
462
- $(this).addClass('active');
463
- view = VIEW_TYPE[$(this).attr('tab')];
464
- if (auth.view.currentView != view) { auth.view.switchView(view); }
465
-
466
- $('.rg-preview-widget, .content-warp').scrollTop(10000);
467
- });
468
-
469
- enableContentEditable(auth, $('.rg-preview-widget-container'));
470
- restoreContent(auth, $('.rg-preview-widget-container'));
471
-
472
- $('.save').click(function() {
473
- $('.save').css('opacity', 0.4);
474
- saveContent(auth, $('.rg-preview-widget-container'), false);
475
- });
476
-
477
- window.refresh_readygraph = function() {
478
- restoreContent(auth, $('.rg-preview-widget-container'));
479
- }
480
- });
481
- });
482
- });
483
- });
484
- }
485
- function enableContentEditable(model, container) {
486
- model.view.$el.find('[rgw-data-key]').each(function() {
487
- var element = $(this);
488
- if (element.attr('rgw-data-editable') == 'false') return;
489
-
490
- if (element.attr('editing') != null) return;
491
- container.find('.special-button-container button').attr('disabled', 'disabled');
492
- element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
493
- element.attr('editing', '1');
494
- element.css({
495
- 'border': '2px dashed orange',
496
- 'position': 'relative',
497
- 'top': '-2px',
498
- 'margin-bottom': '-4px',
499
- 'background-color': '#FAFAC5'
500
- });
501
- element.attr('contenteditable', true);
502
- element.bind('paste', function(e) {
503
- e.preventDefault();
504
- });
505
- element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
506
- });
507
- }
508
- function saveContent(model, container, fake) {
509
- var settings = {};
510
- model.view.$el.find('[rgw-data-key]').each(function() {
511
- var element = $(this);
512
- if (element.attr('rgw-data-editable') == 'false') return;
513
- settings[element.attr('rgw-data-key')] = element.text();
514
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
515
- });
516
- if (!fake) {
517
- $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
518
- $('#myForm')[0].submit();
519
- }
520
- }
521
- function restoreContent(model, container) {
522
- eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
523
- var settings = window._TEMP;
524
- if (settings) {
525
- model.view.$el.find('[rgw-data-key]').each(function() {
526
- var element = $(this);
527
- if (element.attr('rgw-data-editable') == 'false') return;
528
- element.text(settings[element.attr('rgw-data-key')]);
529
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
530
- });
531
- }
532
- }
533
- </script>
534
- <style>
535
- /* FOR INLINE WIDGET */
536
- .rgw-overlay {
537
- display: none !important;
538
- }
539
- .rgw-content-frame {
540
- left: 0 !important;
541
- top: 0 !important;
542
- position: relative !important;
543
- margin: 0 auto !important;
544
- border: solid 1px #cccccc;
545
- }
546
- .rgw-preview-warning {
547
- display: none !important;
548
- }
549
- .rgw-content {
550
- position: relative !important;
551
- }
552
- </style>
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
  /**
4
  * Represents the view for the administration dashboard.
5
  *
12
  * @link http://www.readygraph.com
13
  * @copyright 2014 Your Name or Company Name
14
  */
15
+ include("header.php");
 
 
 
 
 
 
 
 
 
 
 
 
16
 
 
 
 
17
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
18
  //redirect to main page
19
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
31
  }
32
  ?>
33
 
 
 
34
  <form method="post" id="myForm">
35
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
36
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
37
  <input type="hidden" name="readygraph_email" value="<?php echo get_option('readygraph_email', '') ?>">
38
  <input type="hidden" name="readygraph_application_id" value="<?php echo get_option('readygraph_application_id', '') ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  <div class="tutorial-true" style="margin: 5% auto;">
40
  <h3 style="font-weight: normal; text-align: center;">Next Step: Customize automated emails to engage your userbase</h3>
41
  <h4 style="font-weight: normal; text-align: center;">Head over to ReadyGraph.com to customize emails such as:</h4>
49
  <a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=basic-settings" style="margin: 15px">Skip, End Tutorial</a>
50
  </div></div>
51
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
+ </form>
54
+ <?php include("footer.php"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
extension/readygraph/deactivate-readygraph.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Represents the view for the administration dashboard.
4
  *
@@ -11,23 +12,8 @@
11
  * @link http://www.readygraph.com
12
  * @copyright 2014 Your Name or Company Name
13
  */
 
14
 
15
- function s2_disconnectReadyGraph(){
16
- $app_id = get_option('readygraph_application_id');
17
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=disconnect_readygraph&app_id=$app_id" );
18
- s2_delete_rg_options();
19
- }
20
- function s2_deleteReadyGraph(){
21
- $app_id = get_option('readygraph_application_id');
22
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=uninstall_readygraph&app_id=$app_id" );
23
- s2_delete_rg_options();
24
- $dir = plugin_dir_path( __FILE__ );
25
- s2_rrmdir($dir);
26
- }
27
-
28
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "changeaccount")s2_disconnectReadyGraph();
29
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "deleteaccount")s2_deleteReadyGraph();
30
- global $main_plugin_title;
31
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
32
  //redirect to main page
33
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
@@ -40,35 +26,9 @@ s2_rrmdir($dir);
40
  if (isset($_POST["readygraph_application_id"])) update_option('readygraph_application_id', $_POST["readygraph_application_id"]);
41
  if (isset($_POST["readygraph_settings"])) update_option('readygraph_settings', $_POST["readygraph_settings"]);
42
  if (isset($_POST["retentionemaileditor"])) update_option('readygraph_invite_email', $_POST["retentionemaileditor"]);
43
- /*if (isset($_POST["readygraph_delay"])) {
44
- update_option('readygraph_delay', $_POST["delay"]);
45
- $app_id = get_option('readygraph_application_id');
46
- if ($_POST["delay"] >= 20000) wp_remote_get( "http://readygraph.com/api/v1/tracking?event=popup_delay&app_id=$app_id" );
47
- }
48
- if (isset($_POST["readygraph_enable_notification"])) update_option('readygraph_enable_notification', $_POST["notification"]);
49
- if (isset($_POST["readygraph_enable_sidebar"])) update_option('readygraph_enable_sidebar', $_POST["sidebar"]);
50
- if (isset($_POST["readygraph_auto_select_all"])) update_option('readygraph_auto_select_all', $_POST["selectAll"]);
51
- if (isset($_POST["readygraph_enable_branding"])) update_option('readygraph_enable_branding', $_POST["branding"]);
52
- if (isset($_POST["readygraph_send_blog_updates"])) update_option('readygraph_send_blog_updates', $_POST["blog_updates"]);
53
- if (isset($_POST["readygraph_send_real_time_post_updates"])) update_option('readygraph_send_real_time_post_updates', $_POST["real_time_post_update"]);
54
- if (isset($_POST["readygraph_popup_template"])) update_option('readygraph_popup_template', $_POST["popup_template"]);
55
- /*if (isset($_POST["readygraph_popup_template_background"])) update_option('readygraph_popup_template_background', $_POST["readygraph_popup_template_background"]);
56
- if (isset($_POST["readygraph_popup_template_text"])) update_option('readygraph_popup_template_text', $_POST["readygraph_popup_template_text"]);
57
- if (isset($_POST["readygraph_popup_template_button"])) update_option('readygraph_popup_template_button', $_POST["readygraph_popup_template_button"]);*/
58
-
59
  }
60
- if (get_option('readygraph_enable_branding', '') == 'false') {
61
- ?>
62
- <style>
63
- /* FOR INLINE WIDGET */
64
- .rgw-text {
65
- display: none !important;
66
- }
67
- </style>
68
- <?php } ?>
69
 
70
- <link rel="stylesheet" type="text/css" href="<?php echo plugins_url( 'assets/css/admin.css', __FILE__ ) ?>">
71
- <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/admin.js', __FILE__ ) ?>"></script>
72
  <form method="post" id="myForm">
73
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
74
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
@@ -83,119 +43,7 @@ s2_rrmdir($dir);
83
  <input type="hidden" name="readygraph_send_blog_updates" value="<?php echo get_option('readygraph_send_blog_updates', 'true') ?>">
84
  <input type="hidden" name="readygraph_send_real_time_post_updates" value="<?php echo get_option('readygraph_send_real_time_post_updates', 'false') ?>">
85
  <input type="hidden" name="readygraph_popup_template" value="<?php echo get_option('readygraph_popup_template', 'default-template') ?>">
86
- <!--<input type="hidden" name="readygraph_popup_template_background" value="<?php //echo get_option('readygraph_popup_template_background', '') ?>">
87
- <input type="hidden" name="readygraph_popup_template_text" value="<?php //echo get_option('readygraph_popup_template_text', '') ?>">
88
- <input type="hidden" name="readygraph_popup_template_button" value="<?php //echo get_option('readygraph_popup_template_button', '') ?>">-->
89
-
90
- <div class="authenticate" style="display: none;">
91
- <div class="wrap1" style="min-height: 600px;">
92
-
93
- <div id="icon-plugins" class="icon32"></div>
94
- <h2>We've enhanced <?php echo $main_plugin_title ?> with ReadyGraph's User Growth Engine</h2>
95
-
96
- <p style="display:none;color:red;" id="error"></p>
97
- <div class="register-left">
98
- <div class="alert" style="margin: 0px auto; padding: 15px; text-align: center;">
99
- <h3>Activate ReadyGraph to get more traffic to your site</h3>
100
- <!-- <h3 style="margin-top: 0px; font-weight: 300;"><?php //echo $main_plugin_title ?>, Now with ReadyGraph</h3> -->
101
- <p style="padding: 50px 0px 30px 0px;"><a class="btn btn-primary connect" href="javascript:void(0);" style="font-size: 15px; line-height: 40px; padding: 0 30px;">Connect ReadyGraph</a></p>
102
- <!--<p style="padding: 0px 0px;"><a class="btn btn-default skip" href="javascript:void(0);" style="font-size: 10px; line-height: 20px; padding: 0 30px;">Skip ReadyGraph</a></p>-->
103
- <p>Readygraph adds more ways to connect to your users. </p>
104
- <p style="text-align: left; padding: 0 20px;">
105
- - Get more traffic<br>
106
- - Send automatic email digests of all your site posts<br>
107
- - Get better deliverablility<br>
108
- - Track performace and user activity
109
- </p>
110
- </div>
111
-
112
- </div>
113
 
114
- <div class="register-right">
115
- <div class="form-wrap alert" style="font-size:12px;">
116
- <p><h3>ReadyGraph grows your site</h3></p>
117
- <p>ReadyGraph delivers audience growth and motivates users to come back.</p><br /><p><span class="rg-signup-icon"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_fb.png"></span><b>Optimized Signup Form –</b> ReadyGraph’s signup form has one click signup and integration with Facebook so you can get quick and easy signups from your users.<br /><br /><span class="rg-signup-icon"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_heart.png"></span>
118
- <b>Viral Friend Invites –</b>Loyal site visitors who love your site can easily invite all their friends. Readygraph encourages your visitors' friends to come and signup for your site too.<br /><br /><b><span class="rg-signup-icon"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_mail.png"></span>Automated Re-engagement Emails –</b> ReadyGraph’s automated emails keep visitors coming back. Send a daily or weekly digest of all your new posts and keep them informed about site activity, events, etc.<br /><br /><b><span class="rg-signup-icon"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_chart.png"></span>Analytics -</b> Track new subscribers, invites, traffic, and other key metrics that quantify growth and user engagement. ReadyGraph safely stores user data on the cloud so you can access from anywhere.<br /><br />
119
- If you have questions or concerns contact us anytime at <a href="mailto:info@readygraph.com" target="_blank">info@readygraph.com</a></p>
120
- </div>
121
- </div>
122
- </div>
123
- </div>
124
- <div class="authenticating" style="display: none;">
125
- <div style="color: #ffffff; width: 350px; margin: 100px auto 0px; padding: 15px; border: solid 1px #2a388f; text-align: center; background-color: #2961cb; -webkit-border-radius: 7px; -moz-border-radius: 7px; border-radius: 7px;">
126
- <h3 style="margin-top: 0px; font-weight: 300;"><?php echo $main_plugin_title ?>, Now with ReadyGraph</h3>
127
- <h4 style="padding: 50px 0; line-height: 42px;">Retrieving Your Account..</h4>
128
- <p>Activate Readygraph features to optimize <?php echo $main_plugin_title ?> functionality. Signup For These Benefits:</p>
129
- <p style="text-align: left; padding: 0 20px;">
130
- - Grow your subscribers faster<br>
131
- - Engage users with automated email updates<br>
132
- - Enhanced email deliverablility<br>
133
- - Track performace with user-activity analytics
134
- </p>
135
- </div>
136
- </div>
137
- <style>a.help-tooltip {outline:none; }a.help-tooltip strong {line-height:30px;}a.help-tooltip:hover {text-decoration:none;} a.help-tooltip span { z-index:10;display:none; padding:14px 20px; margin-top:40px; margin-left:-150px; width:300px; line-height:16px;}a.help-tooltip:hover span{ display:inline; position:absolute; border:2px solid #FFF; background:#fff; text-align: justify; z-index:1000000000;}.callout {z-index:1000000000;position:absolute;border:0;top:-14px;left:120px;} /*CSS3 extras*/a.help-tooltip span{ border-radius:2px; -moz-border-radius: 2px; -webkit-border-radius: 2px; -moz-box-shadow: 0px 0px 8px 4px #666; -webkit-box-shadow: 0px 0px 8px 4px #666; box-shadow: 0px 0px 8px 4px #666;}</style>
138
- <div class="authenticated" style="display: none;">
139
- <div style="background-color: #2961cb; min-width: 90%; height: 50px;margin-right: 1%;">
140
- <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/white-logo.png" style="width: 138px; height: 30px; margin: 10px 0 0 15px; float: left;">
141
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
142
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
143
- <span class="email-address" style="text-shadow: none;"></span> <span class="caret"></span>
144
- </button>
145
- <ul class="dropdown-menu">
146
- <li><a class="change-account" href="#">Change Account</a></li>
147
- <li><a class="disconnect" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("changeaccount");?>">Disconnect</a></li>
148
- <li><a class="delete" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("deleteaccount");?>">Delete ReadyGraph</a></li>
149
- </ul>
150
- </div>
151
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
152
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
153
- <span class="result" style="text-shadow: none;">...</span> <span class="caret"></span>
154
- </button>
155
- <ul class="dropdown-menu">
156
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Insights</a></li>
157
- </ul>
158
- </div>
159
- <div style="clear: both;"></div>
160
- </div>
161
- <!-- write menu code-->
162
- <div class="readygraph-menu">
163
- <div class="menu-tabs"><h4>Grow Users</h4>
164
- <ul>
165
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
166
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
167
- <li><a href="#"></a></li>
168
- </ul>
169
- </div>
170
- <div class="menu-tabs"><h4>Email Users</h4>
171
- <ul>
172
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
173
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
174
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
175
- </ul>
176
- </div>
177
- <div class="menu-tabs"><h4>Engage Users</h4>
178
- <ul>
179
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed">Social Feed</a></li>
180
- <li><a href="#">Social Followers</a></li>
181
- <li><a href="#">Feedback Survey</a></li>
182
- </ul>
183
- </div>
184
- <div class="menu-tabs"><h4>Basic Settings</h4>
185
- <ul>
186
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
187
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=feature-settings">Feature Settings</a></li>
188
-
189
- </ul>
190
- </div>
191
- <div class="menu-tabs" style="float:right"><h4>&nbsp;</h4>
192
- <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
193
- <p>
194
- <a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=faq" style="color: #b1c1ca" >FAQ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/10.png" /></a></p>
195
-
196
- </ul>
197
- </div>
198
- </div>
199
  <div style="margin: 0 5%">
200
  <h2>Deactivate ReadyGraph</h2>
201
  <h3> Uh oh! Are you sure you wish to deactivate ReadyGraph?</h3>
@@ -209,383 +57,12 @@ If you have questions or concerns contact us anytime at <a href="mailto:info@rea
209
 
210
  <h3>I'm sure. What do I do now?</h3>
211
  <p>If you are sure you want to deactivate Readygraph, you have two options: </p>
212
- <p>Deactivate. This turns ReadyGraph off, but you still have the abiity to reactivate Readygraph in the future should change your mind. <br><a href="#">Deactivate ReadyGraph</a></p>
213
- <p>Delete. This will permanently removes all code and files associated with ReadyGraph from your website.<br><a href="#">Permanently Delete ReadyGraph</a></p>
214
  <p>&nbsp;</p>
215
  <p>Thanks a lot and good luck with your site!</p>
216
  <p>&nbsp;</p>
217
- <p><a href="#">Nevermind, I want to keep growing my audience with ReadyGraph</a></p>
218
  </div>
219
- </div>
220
  </form>
221
- <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
222
- <script type="text/javascript" charset="utf-8">
223
- var $ = jQuery;
224
- $(function () {
225
- var settings =
226
- {
227
- 'host': "www.readygraph.com"
228
- , 'clientId': "9838eb84c6da2fc44ab9"
229
- };
230
-
231
- var authHost = "https://" + settings.host;
232
- var resourceHost = "https://" + settings.host;
233
-
234
- // OAuth 2.0 Popup
235
- //
236
- var popupWindow=null;
237
- function openPopup(url)
238
- {
239
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
240
- else popupWindow = window.open(url,"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=515, height=330,top=" + (screen.height - 330)/2 + ",left=" + (screen.width - 515)/2);
241
- }
242
- function parent_disable() {
243
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
244
- }
245
-
246
- $("a.connect").click(function() {
247
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
248
- openPopup(url);
249
- $(document.body).bind('focus', parent_disable);
250
- $(document.body).bind('click', parent_disable);
251
- });
252
- $(".change-account").click(function() {
253
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
254
- var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
255
- openPopup(logout);
256
- $(document.body).bind('focus', parent_disable);
257
- $(document.body).bind('click', parent_disable);
258
- });
259
-
260
- // User Interface
261
- //
262
- $('.template').click(function() {
263
- $('#preview').attr('src', $(this).find('img').attr('src'));
264
- });
265
-
266
- // Manage OAuth 2.0 Redirect
267
- //
268
- var extractCode = function(hash) {
269
- var match = hash.match(/code=(\w+)/);
270
- return !!match && match[1];
271
- };
272
- var extractToken = function(hash) {
273
- var match = hash.match(/access_token=(\w+)/);
274
- return !!match && match[1];
275
- };
276
- var extractError = function(hash) {
277
- var match = hash.match(/error=(\w+)/);
278
- return !!match && match[1];
279
- };
280
-
281
- var code = extractCode(window.location.href);
282
- if (extractError(window.location.href) == 'access_denied') {
283
- window.close();
284
- }
285
- else if(code) {
286
- try { window.opener.setCode(code); }
287
- catch(ex) { }
288
- window.close();
289
- }
290
- else {
291
- $('.rgw-fb-login-button-iframe').hide();
292
- $('div.authenticate').show();
293
-
294
- if ($('[name="readygraph_access_token"]').val()) {
295
- $('.rgw-fb-login-button-iframe').show();
296
- $('div.authenticate').hide();
297
- $('div.authenticating').hide();
298
- $('div.authenticated').show();
299
-
300
- $('.email-address').text($('[name="readygraph_email"]').val());
301
-
302
- window.setup_readygraph($('[name="readygraph_application_id"]').val());
303
- $('.delay').val($('[name="readygraph_delay"]').val());
304
- $('.sidebar').val($('[name="readygraph_enable_sidebar"]').val());
305
- $('.notification').val($('[name="readygraph_enable_notification"]').val());
306
- $('.selectAll').val($('[name="readygraph_auto_select_all"]').val());
307
- $('.branding').val($('[name="readygraph_enable_branding"]').val());
308
- $('.blog_updates').val($('[name="readygraph_send_blog_updates"]').val());
309
- $('.real_time_post_update').val($('[name="readygraph_send_real_time_post_updates"]').val());
310
- $('.popup_template').val($('[name="readygraph_popup_template"]').val());
311
-
312
- //$('[name="readygraph_ad_format"][value="' + $('[name="_readygraph_ad_format"]').val() + '"]').parent().click();
313
- //$('[name="readygraph_ad_timing"][value="' + $('[name="_readygraph_ad_timing"]').val() + '"]').parent().click();
314
-
315
- //$('[name="readygraph_ad_delay"]').val($('[name="_readygraph_ad_delay"]').val());
316
- //$('[name="readygraph_ad_scroll"]').val($('[name="_readygraph_ad_scroll"]').val());
317
-
318
- $('.result').text('...');
319
- if ($('[name="readygraph_access_token"]').val()) {
320
- $.ajax({
321
- url: resourceHost + '/api/v1/insight_info'
322
- , beforeSend: function (xhr) {
323
- xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
324
- xhr.setRequestHeader('Accept', "application/json");
325
- }
326
- , method: 'POST'
327
- , success: function (response) {
328
- if (response.data) {
329
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
330
- } else {
331
- $('.result').text('Insight');
332
- }
333
- }
334
- , error: function (response) {
335
- refresh_access_token();
336
- }
337
- });
338
- }
339
- }
340
- }
341
-
342
- // Manage OAuth 2.0 Results
343
- //
344
- function refresh_access_token() {
345
- var refresh_token = $('[name="readygraph_refresh_token"]').val();
346
- if (refresh_token) {
347
- $('div.authenticate').hide();
348
- $('div.authenticating').show();
349
- $('div.authenticated').hide();
350
-
351
- $.ajax({
352
- url: resourceHost + '/oauth/access_token'
353
- , data: {
354
- grant_type: 'refresh_token',
355
- refresh_token: $('[name="readygraph_refresh_token"]').val(),
356
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
357
- client_id: settings.clientId
358
- }
359
- , method: 'POST'
360
- , success: function (response) {
361
- $('[name="readygraph_access_token"]').val(response.access_token);
362
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
363
- window.setAccessToken(response.access_token);
364
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
365
- }
366
- , error: function (response) {
367
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
368
- $('div.authenticate').show();
369
- $('div.authenticating').hide();
370
- $('div.authenticated').hide();
371
- }
372
- });
373
- }
374
- }
375
- window.setCode = function(code) {
376
- $('.rgw-fb-login-button-iframe').hide();
377
- $('div.authenticate').hide();
378
- $('div.authenticating').show();
379
- $('div.authenticated').hide();
380
-
381
- $.ajax({
382
- url: resourceHost + '/oauth/access_token'
383
- , data: {
384
- grant_type: 'authorization_code',
385
- code: code,
386
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
387
- client_id: settings.clientId
388
- }
389
- , method: 'POST'
390
- , success: function (response) {
391
- if (response) {
392
- $('[name="readygraph_access_token"]').val(response.access_token);
393
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
394
- window.setAccessToken(response.access_token);
395
- } else {
396
- $('div.authenticating').hide();
397
- $('div.authenticate').show();
398
- }
399
- }
400
- });
401
- }
402
- window.setAccessToken = function(token) {
403
- $('.rgw-fb-login-button-iframe').hide();
404
- $('div.authenticate').hide();
405
- $('div.authenticating').show();
406
- $('div.authenticated').hide();
407
-
408
- $.ajax({
409
- url: resourceHost + '/api/v1/account_info'
410
- , beforeSend: function (xhr) {
411
- xhr.setRequestHeader('Authorization', "Bearer " + token);
412
- xhr.setRequestHeader('Accept', "application/json");
413
- }
414
- , method: 'POST'
415
- , success: function (response) {
416
- if (response.data) {
417
- $('[name="readygraph_access_token"]').val(token);
418
- $('[name="readygraph_email"]').val(response.data.email);
419
- $('[name="readygraph_application_id"]').val(response.data.application_id);
420
- $('#myForm')[0].submit();
421
- } else {
422
- $('div.authenticating').hide();
423
- $('div.authenticate').show();
424
- $('.rgw-fb-login-button-iframe').hide();
425
- }
426
- }
427
- });
428
- }
429
- });
430
- </script>
431
- <script>
432
- window.setup = false;
433
- window.refresh_readygraph = function() {};
434
- window.setup_readygraph = function(app_id) {
435
- if (window.setup) {
436
- window.refresh_readygraph();
437
- return;
438
- }
439
- window.setup = true;
440
- readygraph.setup({
441
- applicationId: app_id,
442
- isPreview: true,
443
- enableLoginWall: false,
444
- enableDistraction: false,
445
- enableAutoLogin: false,
446
- enableSidebar: false,
447
- enableNotification: false,
448
- enableInvite: false,
449
- enableOpenGraph: false,
450
- enableRgSeo: false
451
- });
452
- readygraph.ready(function() {
453
- readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
454
- var $ = readygraph.framework.jQuery;
455
- $.cookie('RGAuth', null);
456
- readygraph.framework.facebook.logout(function() {
457
- readygraph.framework.require(['invite'], function() {
458
- var VIEW_TYPE = {
459
- LOADING: 0,
460
- LOGIN_REQUIRE: 1,
461
- PERMISSION_REQUIRE: 2,
462
- DEFAULT: 3,
463
- LOGIN_WITH_EMAIL: 4,
464
- SIGNUP_WITH_EMAIL: 5,
465
- IMPORT_WITH_EMAIL: 6,
466
- FINISH: 10
467
- };
468
-
469
- var auth = new readygraph.framework.ui.AuthModel({
470
- dialog: true,
471
- 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
472
- });
473
- $('.rg-preview-widget').html('');
474
- $('.rg-preview-widget').append(auth.lightbox.view.$el);
475
- $('.rgw-content').attr('style', 'position: relative !important;');
476
-
477
- var view = VIEW_TYPE.LOGIN_REQUIRE;
478
- auth.on('switch', function() {
479
- if (auth.view.currentView != view) { auth.view.switchView(view); }
480
- else auth.view.render();
481
- if (view == VIEW_TYPE.DEFAULT) {
482
- auth.view.$el.find('.rgw-invite-view').showAndAnimate();
483
- auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
484
- auth.view.$el.commitTransition();
485
- }
486
- });
487
- auth.view.switchView(view);
488
-
489
- $(window).scroll(function() {
490
- $(window).trigger('rgw-invalidate');
491
- });
492
- $('.rg-preview-widget, .content-warp').scroll(function() {
493
- $(window).trigger('rgw-invalidate');
494
- });
495
- $(window).trigger('rgw-invalidate');
496
-
497
- $('.rg-vertical-tab').click(function() {
498
- saveContent(auth, $('.rg-preview-widget-container'), true);
499
-
500
- $('.rg-vertical-tab').removeClass('active');
501
- $(this).addClass('active');
502
- view = VIEW_TYPE[$(this).attr('tab')];
503
- if (auth.view.currentView != view) { auth.view.switchView(view); }
504
-
505
- $('.rg-preview-widget, .content-warp').scrollTop(10000);
506
- });
507
-
508
- enableContentEditable(auth, $('.rg-preview-widget-container'));
509
- restoreContent(auth, $('.rg-preview-widget-container'));
510
-
511
- $('.save').click(function() {
512
- $('.save').css('opacity', 0.4);
513
- saveContent(auth, $('.rg-preview-widget-container'), false);
514
- });
515
-
516
- window.refresh_readygraph = function() {
517
- restoreContent(auth, $('.rg-preview-widget-container'));
518
- }
519
- });
520
- });
521
- });
522
- });
523
- }
524
- function enableContentEditable(model, container) {
525
- model.view.$el.find('[rgw-data-key]').each(function() {
526
- var element = $(this);
527
- if (element.attr('rgw-data-editable') == 'false') return;
528
-
529
- if (element.attr('editing') != null) return;
530
- container.find('.special-button-container button').attr('disabled', 'disabled');
531
- element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
532
- element.attr('editing', '1');
533
- element.css({
534
- 'border': '2px dashed orange',
535
- 'position': 'relative',
536
- 'top': '-2px',
537
- 'margin-bottom': '-4px',
538
- 'background-color': '#FAFAC5'
539
- });
540
- element.attr('contenteditable', true);
541
- element.bind('paste', function(e) {
542
- e.preventDefault();
543
- });
544
- element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
545
- });
546
- }
547
- function saveContent(model, container, fake) {
548
- var settings = {};
549
- model.view.$el.find('[rgw-data-key]').each(function() {
550
- var element = $(this);
551
- if (element.attr('rgw-data-editable') == 'false') return;
552
- settings[element.attr('rgw-data-key')] = element.text();
553
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
554
- });
555
- if (!fake) {
556
- $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
557
- $('#myForm')[0].submit();
558
- }
559
- }
560
- function restoreContent(model, container) {
561
- eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
562
- var settings = window._TEMP;
563
- if (settings) {
564
- model.view.$el.find('[rgw-data-key]').each(function() {
565
- var element = $(this);
566
- if (element.attr('rgw-data-editable') == 'false') return;
567
- element.text(settings[element.attr('rgw-data-key')]);
568
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
569
- });
570
- }
571
- }
572
- </script>
573
- <style>
574
- /* FOR INLINE WIDGET */
575
- .rgw-overlay {
576
- display: none !important;
577
- }
578
- .rgw-content-frame {
579
- left: 0 !important;
580
- top: 0 !important;
581
- position: relative !important;
582
- margin: 0 auto !important;
583
- border: solid 1px #cccccc;
584
- }
585
- .rgw-preview-warning {
586
- display: none !important;
587
- }
588
- .rgw-content {
589
- position: relative !important;
590
- }
591
- </style>
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
  /**
4
  * Represents the view for the administration dashboard.
5
  *
12
  * @link http://www.readygraph.com
13
  * @copyright 2014 Your Name or Company Name
14
  */
15
+ include("header.php");
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
18
  //redirect to main page
19
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
26
  if (isset($_POST["readygraph_application_id"])) update_option('readygraph_application_id', $_POST["readygraph_application_id"]);
27
  if (isset($_POST["readygraph_settings"])) update_option('readygraph_settings', $_POST["readygraph_settings"]);
28
  if (isset($_POST["retentionemaileditor"])) update_option('readygraph_invite_email', $_POST["retentionemaileditor"]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
30
+ ?>
 
 
 
 
 
 
 
 
31
 
 
 
32
  <form method="post" id="myForm">
33
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
34
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
43
  <input type="hidden" name="readygraph_send_blog_updates" value="<?php echo get_option('readygraph_send_blog_updates', 'true') ?>">
44
  <input type="hidden" name="readygraph_send_real_time_post_updates" value="<?php echo get_option('readygraph_send_real_time_post_updates', 'false') ?>">
45
  <input type="hidden" name="readygraph_popup_template" value="<?php echo get_option('readygraph_popup_template', 'default-template') ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  <div style="margin: 0 5%">
48
  <h2>Deactivate ReadyGraph</h2>
49
  <h3> Uh oh! Are you sure you wish to deactivate ReadyGraph?</h3>
57
 
58
  <h3>I'm sure. What do I do now?</h3>
59
  <p>If you are sure you want to deactivate Readygraph, you have two options: </p>
60
+ <p>Deactivate. This turns ReadyGraph off, but you still have the abiity to reactivate Readygraph in the future should change your mind. <br><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("changeaccount");?>">Deactivate ReadyGraph</a></p>
61
+ <p>Delete. This will permanently removes all code and files associated with ReadyGraph from your website.<br><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("deleteaccount");?>">Permanently Delete ReadyGraph</a></p>
62
  <p>&nbsp;</p>
63
  <p>Thanks a lot and good luck with your site!</p>
64
  <p>&nbsp;</p>
65
+ <p><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>">Nevermind, I want to keep growing my audience with ReadyGraph</a></p>
66
  </div>
 
67
  </form>
68
+ <?php include("footer.php"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
extension/readygraph/extension.php CHANGED
@@ -1,124 +1,15 @@
1
  <?php
 
2
  // ReadyGraph Extension
3
  //
4
- if(!function_exists('add_readygraph_plugin_warning')) {
5
- function add_readygraph_plugin_warning() {
6
- if (get_option('readygraph_access_token', '') != '') return;
7
 
8
- global $hook_suffix, $current_user, $menu_slug;
9
- if(isset($_GET["readygraph_notice"]) && $_GET["readygraph_notice"] == "dismiss") update_option('readygraph_connect_notice','false');
10
- if ( $hook_suffix == 'plugins.php' && get_option('readygraph_connect_notice') == 'true' ) {
11
- echo '<div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
12
- <style type="text/css">
13
- .readygraph_activate {
14
- min-width:825px;
15
- padding:7px;
16
- margin:15px 0;
17
- background:#1b75bb;
18
- -moz-border-radius:3px;
19
- border-radius:3px;
20
- -webkit-border-radius:3px;
21
- position:relative;
22
- overflow:hidden;
23
- }
24
- .readygraph_activate .aa_button {
25
- cursor: pointer;
26
- -moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
27
- -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
28
- box-shadow:inset 0px 1px 0px 0px #ffffff;
29
- background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #f9f9f9), color-stop(1, #e9e9e9) );
30
- background:-moz-linear-gradient( center top, #f9f9f9 5%, #e9e9e9 100% );
31
- filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#f9f9f9", endColorstr="#e9e9e9");
32
- background-color:#f9f9f9;
33
- -webkit-border-top-left-radius:3px;
34
- -moz-border-radius-topleft:3px;
35
- border-top-left-radius:3px;
36
- -webkit-border-top-right-radius:3px;
37
- -moz-border-radius-topright:3px;
38
- border-top-right-radius:3px;
39
- -webkit-border-bottom-right-radius:3px;
40
- -moz-border-radius-bottomright:3px;
41
- border-bottom-right-radius:3px;
42
- -webkit-border-bottom-left-radius:3px;
43
- -moz-border-radius-bottomleft:3px;
44
- border-bottom-left-radius:3px;
45
- text-indent:0;
46
- border:1px solid #dcdcdc;
47
- display:inline-block;
48
- color:#333333;
49
- font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
50
- font-size:15px;
51
- font-weight:normal;
52
- font-style:normal;
53
- height:40px;
54
- line-height:40px;
55
- width:275px;
56
- text-decoration:none;
57
- text-align:center;
58
- text-shadow:1px 1px 0px #ffffff;
59
- }
60
- .readygraph_activate .aa_button:hover {
61
- background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #e9e9e9), color-stop(1, #f9f9f9) );
62
- background:-moz-linear-gradient( center top, #e9e9e9 5%, #f9f9f9 100% );
63
- filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#e9e9e9", endColorstr="#f9f9f9");
64
- background-color:#e9e9e9;
65
- }
66
- .readygraph_activate .aa_button:active {
67
- position:relative;
68
- top:1px;
69
- }
70
- /* This button was generated using CSSButtonGenerator.com */
71
- .readygraph_activate .aa_description {
72
- position:absolute;
73
- top:19px;
74
- left:285px;
75
- margin-left:25px;
76
- color:#ffffff;
77
- font-size:15px;
78
- z-index:1000
79
- }
80
- .readygraph_activate .aa_description strong {
81
- color:#FFF;
82
- font-weight:normal
83
- }
84
- .aa_close {
85
- position: absolute;
86
- right: 18px;
87
- top: 18px;
88
- }
89
- </style>
90
- <form name="readygraph_activate" action="'.admin_url( 'admin.php?page=' . $menu_slug).'" method="POST">
91
- <input type="hidden" name="return" value="1"/>
92
- <input type="hidden" name="jetpack" value="'.(string) class_exists( 'Jetpack' ).'"/>
93
- <input type="hidden" name="user" value="'.esc_attr( $current_user->user_login ).'"/>
94
- <div class="readygraph_activate">
95
- <div class="aa_button" onclick="document.readygraph_activate.submit();">
96
- '.__('Connect Your ReadyGraph Account').'
97
- </div>
98
- <div class="aa_description">'.__('<strong>Almost done</strong> - connect your account to start getting users.').'</div>
99
- <div class="aa_close"><a href="' . $_SERVER["PHP_SELF"] . '?readygraph_notice=dismiss"><img src="'.plugin_dir_url( __FILE__ ).'assets/dialog_close.png"></a></div>
100
- </div>
101
- </form>
102
- </div>';
103
- }
104
- else{
105
- //do nothing
106
- }
107
- }
108
- }
109
- if(!function_exists('readygraph_client_script_head')) {
110
- function readygraph_client_script_head() {
111
- global $readygraph_email_subscribe;
112
- if (get_option('readygraph_access_token', '') != '') {
113
  if (get_option('readygraph_enable_branding', '') == 'false') {
114
- ?>
115
- <style>
116
- /* FOR INLINE WIDGET */
117
- .rgw-text {
118
- display: none !important;
119
- }
120
- </style>
121
- <?php } ?>
122
  <script type='text/javascript'>
123
  var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
124
  var d = top.document;
@@ -130,34 +21,50 @@ script.onload = function(e) {
130
  settings['applicationId'] = '<?php echo get_option('readygraph_application_id', '') ?>';
131
  settings['overrideFacebookSDK'] = true;
132
  settings['platform'] = 'others';
133
- settings['enableLoginWall'] = true;
134
  settings['enableSidebar'] = <?php echo get_option('readygraph_enable_sidebar', 'false') ?>;
135
  settings['inviteFlowDelay'] = <?php echo get_option('readygraph_delay', '5000') ?>;
136
- settings['enableNotification'] = <?php echo get_option('readygraph_enable_notification', 'true') ?>;
137
  settings['inviteAutoSelectAll'] = <?php echo get_option('readygraph_auto_select_all', 'true') ?>;
138
  top.readygraph.setup(settings);
139
  readygraph.ready(function() {
140
  readygraph.framework.require(['auth', 'invite', 'compact.sdk'], function() {
141
  function process(userInfo) {
142
- //<?php echo $readygraph_email_subscribe ?>
143
- //subscribe(userInfo.get('email'), userInfo.get('first_name'), userInfo.get('last_name'));
144
  var rg_email = userInfo.get('email');
145
  var first_name = userInfo.get('first_name');
146
  var last_name = userInfo.get('last_name');
147
- //alert(rg_email);
148
- //var ajaxurl = 'http://readygraph.arhaminfotech.com/wp-admin/admin-ajax.php';
149
- //alert('unfinished1');
150
  jQuery.post(ajaxurl,
151
  {
152
  action : 's2-myajax-submit',
153
  email : rg_email
154
- },
155
- function() {
156
- //alert( 'finished' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  }
158
- );
159
- //alert('unfinished');
160
- }
161
  readygraph.framework.authentication.getUserInfo(function(userInfo) {
162
  if (userInfo.get('uid') != null) {
163
  process(userInfo);
@@ -175,8 +82,4 @@ script.onload = function(e) {
175
  }
176
  h.appendChild(script);
177
  </script>
178
- <?php
179
- }
180
- }
181
- }
182
- ?>
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
  // ReadyGraph Extension
4
  //
 
 
 
5
 
6
+ function s2_readygraph_client_script_head() {
7
+ if(!get_option('readygraph_application_id') && strlen(get_option('readygraph_application_id')) < 0) return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  if (get_option('readygraph_enable_branding', '') == 'false') {
9
+ echo '<style>/* FOR INLINE WIDGET */.rgw-text {display: none !important;}</style>';
10
+ }
11
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
12
+ ?>
 
 
 
 
13
  <script type='text/javascript'>
14
  var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
15
  var d = top.document;
21
  settings['applicationId'] = '<?php echo get_option('readygraph_application_id', '') ?>';
22
  settings['overrideFacebookSDK'] = true;
23
  settings['platform'] = 'others';
24
+ settings['enableLoginWall'] = <?php echo get_option('readygraph_enable_popup', 'false') ?>;
25
  settings['enableSidebar'] = <?php echo get_option('readygraph_enable_sidebar', 'false') ?>;
26
  settings['inviteFlowDelay'] = <?php echo get_option('readygraph_delay', '5000') ?>;
27
+ settings['enableNotification'] = <?php echo get_option('readygraph_enable_notification', 'false') ?>;
28
  settings['inviteAutoSelectAll'] = <?php echo get_option('readygraph_auto_select_all', 'true') ?>;
29
  top.readygraph.setup(settings);
30
  readygraph.ready(function() {
31
  readygraph.framework.require(['auth', 'invite', 'compact.sdk'], function() {
32
  function process(userInfo) {
 
 
33
  var rg_email = userInfo.get('email');
34
  var first_name = userInfo.get('first_name');
35
  var last_name = userInfo.get('last_name');
36
+ <?php if ( is_plugin_active( 'subscribe2/subscribe2.php' ) ) { ?>
 
 
37
  jQuery.post(ajaxurl,
38
  {
39
  action : 's2-myajax-submit',
40
  email : rg_email
41
+ },function(){});
42
+ <?php } ?>
43
+ <?php if ( is_plugin_active( 'email-newsletter/email-newsletter.php' ) ) { ?>
44
+ jQuery.post(ajaxurl,
45
+ {
46
+ action : 'ee-myajax-submit',
47
+ email : rg_email
48
+ },function(){});
49
+ <?php } ?>
50
+ <?php if ( is_plugin_active( 'simple-subscribe/SimpleSubsribe.php' ) ) { ?>
51
+ jQuery.post(ajaxurl,
52
+ {
53
+ action : 'ss-myajax-submit',
54
+ email : rg_email,
55
+ fname : first_name,
56
+ lname : last_name
57
+ },function(){});
58
+ <?php } ?>
59
+ <?php if ( is_plugin_active( 'simple-contact-form/simple-contact-form.php' ) ) { ?>
60
+ jQuery.post(ajaxurl,
61
+ {
62
+ action : 'gCF-myajax-submit',
63
+ email : rg_email,
64
+ name : first_name
65
+ },function(){});
66
+ <?php } ?>
67
  }
 
 
 
68
  readygraph.framework.authentication.getUserInfo(function(userInfo) {
69
  if (userInfo.get('uid') != null) {
70
  process(userInfo);
82
  }
83
  h.appendChild(script);
84
  </script>
85
+ <?php } ?>
 
 
 
 
extension/readygraph/faq.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Represents the view for the administration dashboard.
4
  *
@@ -11,150 +12,24 @@
11
  * @link http://www.readygraph.com
12
  * @copyright 2014 Your Name or Company Name
13
  */
14
-
15
- function s2_disconnectReadyGraph(){
16
- $app_id = get_option('readygraph_application_id');
17
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=disconnect_readygraph&app_id=$app_id" );
18
- s2_delete_rg_options();
19
- }
20
- function s2_deleteReadyGraph(){
21
- $app_id = get_option('readygraph_application_id');
22
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=uninstall_readygraph&app_id=$app_id" );
23
- s2_delete_rg_options();
24
- $dir = plugin_dir_path( __FILE__ );
25
- s2_rrmdir($dir);
26
- }
27
-
28
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "changeaccount")s2_disconnectReadyGraph();
29
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "deleteaccount")s2_deleteReadyGraph();
30
- global $main_plugin_title;
31
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
32
  //redirect to main page
33
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
34
- echo '<script>window.location.replace("'.$current_url[0].'");</script>';
35
  }
36
  else {
37
 
38
  }
39
  ?>
40
 
41
- <link rel="stylesheet" type="text/css" href="<?php echo plugins_url( 'assets/css/admin.css', __FILE__ ) ?>">
42
- <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/admin.js', __FILE__ ) ?>"></script>
43
  <form method="post" id="myForm">
44
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
45
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
46
  <input type="hidden" name="readygraph_email" value="<?php echo get_option('readygraph_email', '') ?>">
47
  <input type="hidden" name="readygraph_application_id" value="<?php echo get_option('readygraph_application_id', '') ?>">
48
 
49
- <div class="authenticate" style="display: none;">
50
- <div class="wrap1" style="min-height: 600px;">
51
-
52
- <div id="icon-plugins" class="icon32"></div>
53
- <h2>We've enhanced <?php echo $main_plugin_title ?> with ReadyGraph's User Growth Engine</h2>
54
-
55
- <p style="display:none;color:red;" id="error"></p>
56
- <div class="register-left">
57
- <div class="alert" style="margin: 0px auto; padding: 15px; text-align: center;">
58
- <h3>Activate ReadyGraph to get more traffic to your site</h3>
59
- <!-- <h3 style="margin-top: 0px; font-weight: 300;"><?php //echo $main_plugin_title ?>, Now with ReadyGraph</h3> -->
60
- <p style="padding: 50px 0px 30px 0px;"><a class="btn btn-primary connect" href="javascript:void(0);" style="font-size: 15px; line-height: 40px; padding: 0 30px;">Connect ReadyGraph</a></p>
61
- <!--<p style="padding: 0px 0px;"><a class="btn btn-default skip" href="javascript:void(0);" style="font-size: 10px; line-height: 20px; padding: 0 30px;">Skip ReadyGraph</a></p>-->
62
- <p>Readygraph adds more ways to connect to your users. </p>
63
- <p style="text-align: left; padding: 0 20px;">
64
- - Get more traffic<br>
65
- - Send automatic email digests of all your site posts<br>
66
- - Get better deliverablility<br>
67
- - Track performace and user activity
68
- </p>
69
- </div>
70
-
71
- </div>
72
-
73
- <div class="register-right">
74
- <div class="form-wrap alert" style="font-size:12px;">
75
- <p><h3>ReadyGraph grows your site</h3></p>
76
- <p>ReadyGraph delivers audience growth and motivates users to come back.</p><br /><p><span class="rg-signup-icon"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_fb.png"></span><b>Optimized Signup Form –</b> ReadyGraph’s signup form has one click signup and integration with Facebook so you can get quick and easy signups from your users.<br /><br /><span class="rg-signup-icon"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_heart.png"></span>
77
- <b>Viral Friend Invites –</b>Loyal site visitors who love your site can easily invite all their friends. Readygraph encourages your visitors' friends to come and signup for your site too.<br /><br /><b><span class="rg-signup-icon"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_mail.png"></span>Automated Re-engagement Emails –</b> ReadyGraph’s automated emails keep visitors coming back. Send a daily or weekly digest of all your new posts and keep them informed about site activity, events, etc.<br /><br /><b><span class="rg-signup-icon"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/icon_chart.png"></span>Analytics -</b> Track new subscribers, invites, traffic, and other key metrics that quantify growth and user engagement. ReadyGraph safely stores user data on the cloud so you can access from anywhere.<br /><br />
78
- If you have questions or concerns contact us anytime at <a href="mailto:info@readygraph.com" target="_blank">info@readygraph.com</a></p>
79
- </div>
80
- </div>
81
- </div>
82
- </div>
83
- <div class="authenticating" style="display: none;">
84
- <div style="color: #ffffff; width: 350px; margin: 100px auto 0px; padding: 15px; border: solid 1px #2a388f; text-align: center; background-color: #2961cb; -webkit-border-radius: 7px; -moz-border-radius: 7px; border-radius: 7px;">
85
- <h3 style="margin-top: 0px; font-weight: 300;"><?php echo $main_plugin_title ?>, Now with ReadyGraph</h3>
86
- <h4 style="padding: 50px 0; line-height: 42px;">Retrieving Your Account..</h4>
87
- <p>Activate Readygraph features to optimize <?php echo $main_plugin_title ?> functionality. Signup For These Benefits:</p>
88
- <p style="text-align: left; padding: 0 20px;">
89
- - Grow your subscribers faster<br>
90
- - Engage users with automated email updates<br>
91
- - Enhanced email deliverablility<br>
92
- - Track performace with user-activity analytics
93
- </p>
94
- </div>
95
- </div>
96
- <style>a.help-tooltip {outline:none; }a.help-tooltip strong {line-height:30px;}a.help-tooltip:hover {text-decoration:none;} a.help-tooltip span { z-index:10;display:none; padding:14px 20px; margin-top:40px; margin-left:-150px; width:300px; line-height:16px;}a.help-tooltip:hover span{ display:inline; position:absolute; border:2px solid #FFF; background:#fff; text-align: justify; z-index:1000000000;}.callout {z-index:1000000000;position:absolute;border:0;top:-14px;left:120px;} /*CSS3 extras*/a.help-tooltip span{ border-radius:2px; -moz-border-radius: 2px; -webkit-border-radius: 2px; -moz-box-shadow: 0px 0px 8px 4px #666; -webkit-box-shadow: 0px 0px 8px 4px #666; box-shadow: 0px 0px 8px 4px #666;}</style>
97
- <div class="authenticated" style="display: none;">
98
- <div style="background-color: #2961cb; min-width: 90%; height: 50px;margin-right: 1%;">
99
- <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/white-logo.png" style="width: 138px; height: 30px; margin: 10px 0 0 15px; float: left;">
100
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
101
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
102
- <span class="email-address" style="text-shadow: none;"></span> <span class="caret"></span>
103
- </button>
104
- <ul class="dropdown-menu">
105
- <li><a class="change-account" href="#">Change Account</a></li>
106
- <li><a class="disconnect" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("changeaccount");?>">Disconnect</a></li>
107
- <li><a class="delete" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("deleteaccount");?>">Delete ReadyGraph</a></li>
108
- </ul>
109
- </div>
110
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
111
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
112
- <span class="result" style="text-shadow: none;">...</span> <span class="caret"></span>
113
- </button>
114
- <ul class="dropdown-menu">
115
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Insights</a></li>
116
- </ul>
117
- </div>
118
- <div style="clear: both;"></div>
119
- </div>
120
- <!-- write menu code-->
121
- <div class="readygraph-menu">
122
- <div class="menu-tabs"><h4>Grow Users</h4>
123
- <ul>
124
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
125
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
126
- <li><a href="#"></a></li>
127
- </ul>
128
- </div>
129
- <div class="menu-tabs"><h4>Email Users</h4>
130
- <ul>
131
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
132
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
133
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
134
- </ul>
135
- </div>
136
- <div class="menu-tabs"><h4>Engage Users</h4>
137
- <ul>
138
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed">Social Feed</a></li>
139
- <li><a href="#">Social Followers</a></li>
140
- <li><a href="#">Feedback Survey</a></li>
141
- </ul>
142
- </div>
143
- <div class="menu-tabs"><h4>Basic Settings</h4>
144
- <ul>
145
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
146
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=feature-settings">Feature Settings</a></li>
147
-
148
- </ul>
149
- </div>
150
- <div class="menu-tabs" style="float:right"><h4>&nbsp;</h4>
151
- <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
152
- <p>
153
- <a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=faq" style="color: #b1c1ca" >FAQ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/10.png" /></a></p>
154
-
155
- </ul>
156
- </div>
157
- </div>
158
  <div class="tutorial-true" style="margin: 5% auto;">
159
  <h3 style="font-weight: normal; text-align: center;">Frequenty Asked Questions</h3>
160
 
@@ -253,377 +128,5 @@ Yes, on the right side of the “ReadyGraph App” page, you will find a link to
253
  If you have questions or concerns, contact us anytime at [info@readygraph.com](mailto:info@readygraph.com)
254
  </div>
255
 
256
- </div>
257
  </form>
258
- <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
259
- <script type="text/javascript" charset="utf-8">
260
- var $ = jQuery;
261
- $(function () {
262
- var settings =
263
- {
264
- 'host': "www.readygraph.com"
265
- , 'clientId': "9838eb84c6da2fc44ab9"
266
- };
267
-
268
- var authHost = "https://" + settings.host;
269
- var resourceHost = "https://" + settings.host;
270
-
271
- // OAuth 2.0 Popup
272
- //
273
- var popupWindow=null;
274
- function openPopup(url)
275
- {
276
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
277
- else popupWindow = window.open(url,"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=515, height=330,top=" + (screen.height - 330)/2 + ",left=" + (screen.width - 515)/2);
278
- }
279
- function parent_disable() {
280
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
281
- }
282
-
283
- $("a.connect").click(function() {
284
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
285
- openPopup(url);
286
- $(document.body).bind('focus', parent_disable);
287
- $(document.body).bind('click', parent_disable);
288
- });
289
- $(".change-account").click(function() {
290
- document.cookie="readygraph_tutorial=true"
291
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
292
- var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
293
- openPopup(logout);
294
- $(document.body).bind('focus', parent_disable);
295
- $(document.body).bind('click', parent_disable);
296
- });
297
-
298
- // User Interface
299
- //
300
- $('.template').click(function() {
301
- $('#preview').attr('src', $(this).find('img').attr('src'));
302
- });
303
-
304
- // Manage OAuth 2.0 Redirect
305
- //
306
- var extractCode = function(hash) {
307
- var match = hash.match(/code=(\w+)/);
308
- return !!match && match[1];
309
- };
310
- var extractToken = function(hash) {
311
- var match = hash.match(/access_token=(\w+)/);
312
- return !!match && match[1];
313
- };
314
- var extractError = function(hash) {
315
- var match = hash.match(/error=(\w+)/);
316
- return !!match && match[1];
317
- };
318
-
319
- var code = extractCode(window.location.href);
320
- if (extractError(window.location.href) == 'access_denied') {
321
- window.close();
322
- }
323
- else if(code) {
324
- try { window.opener.setCode(code); }
325
- catch(ex) { }
326
- window.close();
327
- }
328
- else {
329
- $('.rgw-fb-login-button-iframe').hide();
330
- $('div.authenticate').show();
331
-
332
- if ($('[name="readygraph_access_token"]').val()) {
333
- $('.rgw-fb-login-button-iframe').show();
334
- $('div.authenticate').hide();
335
- $('div.authenticating').hide();
336
- $('div.authenticated').show();
337
-
338
- $('.email-address').text($('[name="readygraph_email"]').val());
339
-
340
- window.setup_readygraph($('[name="readygraph_application_id"]').val());
341
- $('.delay').val($('[name="readygraph_delay"]').val());
342
- $('.sidebar').val($('[name="readygraph_enable_sidebar"]').val());
343
- $('.notification').val($('[name="readygraph_enable_notification"]').val());
344
- $('.selectAll').val($('[name="readygraph_auto_select_all"]').val());
345
- $('.branding').val($('[name="readygraph_enable_branding"]').val());
346
- $('.blog_updates').val($('[name="readygraph_send_blog_updates"]').val());
347
- $('.real_time_post_update').val($('[name="readygraph_send_real_time_post_updates"]').val());
348
- $('.popup_template').val($('[name="readygraph_popup_template"]').val());
349
-
350
- //$('[name="readygraph_ad_format"][value="' + $('[name="_readygraph_ad_format"]').val() + '"]').parent().click();
351
- //$('[name="readygraph_ad_timing"][value="' + $('[name="_readygraph_ad_timing"]').val() + '"]').parent().click();
352
-
353
- //$('[name="readygraph_ad_delay"]').val($('[name="_readygraph_ad_delay"]').val());
354
- //$('[name="readygraph_ad_scroll"]').val($('[name="_readygraph_ad_scroll"]').val());
355
-
356
- $('.result').text('...');
357
- if ($('[name="readygraph_access_token"]').val()) {
358
- $.ajax({
359
- url: resourceHost + '/api/v1/insight_info'
360
- , beforeSend: function (xhr) {
361
- xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
362
- xhr.setRequestHeader('Accept', "application/json");
363
- }
364
- , method: 'POST'
365
- , success: function (response) {
366
- if (response.data) {
367
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
368
- } else {
369
- $('.result').text('Insight');
370
- }
371
- }
372
- , error: function (response) {
373
- refresh_access_token();
374
- }
375
- });
376
- }
377
- }
378
- }
379
-
380
- // Manage OAuth 2.0 Results
381
- //
382
- function refresh_access_token() {
383
- var refresh_token = $('[name="readygraph_refresh_token"]').val();
384
- if (refresh_token) {
385
- $('div.authenticate').hide();
386
- $('div.authenticating').show();
387
- $('div.authenticated').hide();
388
-
389
- $.ajax({
390
- url: resourceHost + '/oauth/access_token'
391
- , data: {
392
- grant_type: 'refresh_token',
393
- refresh_token: $('[name="readygraph_refresh_token"]').val(),
394
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
395
- client_id: settings.clientId
396
- }
397
- , method: 'POST'
398
- , success: function (response) {
399
- $('[name="readygraph_access_token"]').val(response.access_token);
400
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
401
- window.setAccessToken(response.access_token);
402
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
403
- }
404
- , error: function (response) {
405
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
406
- $('div.authenticate').show();
407
- $('div.authenticating').hide();
408
- $('div.authenticated').hide();
409
- }
410
- });
411
- }
412
- }
413
- window.setCode = function(code) {
414
- $('.rgw-fb-login-button-iframe').hide();
415
- $('div.authenticate').hide();
416
- $('div.authenticating').show();
417
- $('div.authenticated').hide();
418
-
419
- $.ajax({
420
- url: resourceHost + '/oauth/access_token'
421
- , data: {
422
- grant_type: 'authorization_code',
423
- code: code,
424
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
425
- client_id: settings.clientId
426
- }
427
- , method: 'POST'
428
- , success: function (response) {
429
- if (response) {
430
- $('[name="readygraph_access_token"]').val(response.access_token);
431
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
432
- window.setAccessToken(response.access_token);
433
- } else {
434
- $('div.authenticating').hide();
435
- $('div.authenticate').show();
436
- }
437
- }
438
- });
439
- }
440
- window.setAccessToken = function(token) {
441
- $('.rgw-fb-login-button-iframe').hide();
442
- $('div.authenticate').hide();
443
- $('div.authenticating').show();
444
- $('div.authenticated').hide();
445
-
446
- $.ajax({
447
- url: resourceHost + '/api/v1/account_info'
448
- , beforeSend: function (xhr) {
449
- xhr.setRequestHeader('Authorization', "Bearer " + token);
450
- xhr.setRequestHeader('Accept', "application/json");
451
- }
452
- , method: 'POST'
453
- , success: function (response) {
454
- if (response.data) {
455
- $('[name="readygraph_access_token"]').val(token);
456
- $('[name="readygraph_email"]').val(response.data.email);
457
- $('[name="readygraph_application_id"]').val(response.data.application_id);
458
- $('#myForm')[0].submit();
459
- } else {
460
- $('div.authenticating').hide();
461
- $('div.authenticate').show();
462
- $('.rgw-fb-login-button-iframe').hide();
463
- }
464
- }
465
- });
466
- }
467
- });
468
- </script>
469
- <script>
470
- window.setup = false;
471
- window.refresh_readygraph = function() {};
472
- window.setup_readygraph = function(app_id) {
473
- if (window.setup) {
474
- window.refresh_readygraph();
475
- return;
476
- }
477
- window.setup = true;
478
- readygraph.setup({
479
- applicationId: app_id,
480
- isPreview: true,
481
- enableLoginWall: false,
482
- enableDistraction: false,
483
- enableAutoLogin: false,
484
- enableSidebar: false,
485
- enableNotification: false,
486
- enableInvite: false,
487
- enableOpenGraph: false,
488
- enableRgSeo: false
489
- });
490
- readygraph.ready(function() {
491
- readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
492
- var $ = readygraph.framework.jQuery;
493
- $.cookie('RGAuth', null);
494
- readygraph.framework.facebook.logout(function() {
495
- readygraph.framework.require(['invite'], function() {
496
- var VIEW_TYPE = {
497
- LOADING: 0,
498
- LOGIN_REQUIRE: 1,
499
- PERMISSION_REQUIRE: 2,
500
- DEFAULT: 3,
501
- LOGIN_WITH_EMAIL: 4,
502
- SIGNUP_WITH_EMAIL: 5,
503
- IMPORT_WITH_EMAIL: 6,
504
- FINISH: 10
505
- };
506
-
507
- var auth = new readygraph.framework.ui.AuthModel({
508
- dialog: true,
509
- 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
510
- });
511
- $('.rg-preview-widget').html('');
512
- $('.rg-preview-widget').append(auth.lightbox.view.$el);
513
- $('.rgw-content').attr('style', 'position: relative !important;');
514
-
515
- var view = VIEW_TYPE.LOGIN_REQUIRE;
516
- auth.on('switch', function() {
517
- if (auth.view.currentView != view) { auth.view.switchView(view); }
518
- else auth.view.render();
519
- if (view == VIEW_TYPE.DEFAULT) {
520
- auth.view.$el.find('.rgw-invite-view').showAndAnimate();
521
- auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
522
- auth.view.$el.commitTransition();
523
- }
524
- });
525
- auth.view.switchView(view);
526
-
527
- $(window).scroll(function() {
528
- $(window).trigger('rgw-invalidate');
529
- });
530
- $('.rg-preview-widget, .content-warp').scroll(function() {
531
- $(window).trigger('rgw-invalidate');
532
- });
533
- $(window).trigger('rgw-invalidate');
534
-
535
- $('.rg-vertical-tab').click(function() {
536
- saveContent(auth, $('.rg-preview-widget-container'), true);
537
-
538
- $('.rg-vertical-tab').removeClass('active');
539
- $(this).addClass('active');
540
- view = VIEW_TYPE[$(this).attr('tab')];
541
- if (auth.view.currentView != view) { auth.view.switchView(view); }
542
-
543
- $('.rg-preview-widget, .content-warp').scrollTop(10000);
544
- });
545
-
546
- enableContentEditable(auth, $('.rg-preview-widget-container'));
547
- restoreContent(auth, $('.rg-preview-widget-container'));
548
-
549
- $('.save').click(function() {
550
- $('.save').css('opacity', 0.4);
551
- saveContent(auth, $('.rg-preview-widget-container'), false);
552
- });
553
-
554
- window.refresh_readygraph = function() {
555
- restoreContent(auth, $('.rg-preview-widget-container'));
556
- }
557
- });
558
- });
559
- });
560
- });
561
- }
562
- function enableContentEditable(model, container) {
563
- model.view.$el.find('[rgw-data-key]').each(function() {
564
- var element = $(this);
565
- if (element.attr('rgw-data-editable') == 'false') return;
566
-
567
- if (element.attr('editing') != null) return;
568
- container.find('.special-button-container button').attr('disabled', 'disabled');
569
- element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
570
- element.attr('editing', '1');
571
- element.css({
572
- 'border': '2px dashed orange',
573
- 'position': 'relative',
574
- 'top': '-2px',
575
- 'margin-bottom': '-4px',
576
- 'background-color': '#FAFAC5'
577
- });
578
- element.attr('contenteditable', true);
579
- element.bind('paste', function(e) {
580
- e.preventDefault();
581
- });
582
- element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
583
- });
584
- }
585
- function saveContent(model, container, fake) {
586
- var settings = {};
587
- model.view.$el.find('[rgw-data-key]').each(function() {
588
- var element = $(this);
589
- if (element.attr('rgw-data-editable') == 'false') return;
590
- settings[element.attr('rgw-data-key')] = element.text();
591
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
592
- });
593
- if (!fake) {
594
- $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
595
- $('#myForm')[0].submit();
596
- }
597
- }
598
- function restoreContent(model, container) {
599
- eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
600
- var settings = window._TEMP;
601
- if (settings) {
602
- model.view.$el.find('[rgw-data-key]').each(function() {
603
- var element = $(this);
604
- if (element.attr('rgw-data-editable') == 'false') return;
605
- element.text(settings[element.attr('rgw-data-key')]);
606
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
607
- });
608
- }
609
- }
610
- </script>
611
- <style>
612
- /* FOR INLINE WIDGET */
613
- .rgw-overlay {
614
- display: none !important;
615
- }
616
- .rgw-content-frame {
617
- left: 0 !important;
618
- top: 0 !important;
619
- position: relative !important;
620
- margin: 0 auto !important;
621
- border: solid 1px #cccccc;
622
- }
623
- .rgw-preview-warning {
624
- display: none !important;
625
- }
626
- .rgw-content {
627
- position: relative !important;
628
- }
629
- </style>
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
  /**
4
  * Represents the view for the administration dashboard.
5
  *
12
  * @link http://www.readygraph.com
13
  * @copyright 2014 Your Name or Company Name
14
  */
15
+ include("header.php");
16
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
18
  //redirect to main page
19
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
20
+ //echo '<script>window.location.replace("'.$current_url[0].'");</script>';
21
  }
22
  else {
23
 
24
  }
25
  ?>
26
 
 
 
27
  <form method="post" id="myForm">
28
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
29
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
30
  <input type="hidden" name="readygraph_email" value="<?php echo get_option('readygraph_email', '') ?>">
31
  <input type="hidden" name="readygraph_application_id" value="<?php echo get_option('readygraph_application_id', '') ?>">
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  <div class="tutorial-true" style="margin: 5% auto;">
34
  <h3 style="font-weight: normal; text-align: center;">Frequenty Asked Questions</h3>
35
 
128
  If you have questions or concerns, contact us anytime at [info@readygraph.com](mailto:info@readygraph.com)
129
  </div>
130
 
 
131
  </form>
132
+ <?php include("footer.php"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
extension/readygraph/footer.php ADDED
@@ -0,0 +1,434 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+ /**
4
+ * Represents the view for the administration dashboard.
5
+ *
6
+ * This includes the header, options, and other information that should provide
7
+ * The User Interface to the end user.
8
+ *
9
+ * @package ReadyGraph
10
+ * @author dan@readygraph.com
11
+ * @license GPL-2.0+
12
+ * @link http://www.readygraph.com
13
+ * @copyright 2014 Your Name or Company Name
14
+ */
15
+
16
+ ?>
17
+
18
+ <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
19
+ <script>
20
+ var $ = jQuery;
21
+ var jsData;
22
+ $(function () {
23
+ var settings =
24
+ {
25
+ 'host': "www.readygraph.com"
26
+ , 'clientId': "9838eb84c6da2fc44ab9"
27
+ };
28
+
29
+ var authHost = "https://" + settings.host;
30
+ var resourceHost = "https://" + settings.host;
31
+ var app_id = "<?php echo get_option('readygraph_application_id');?>";
32
+ var app_secret = "<?php echo get_option('readygraph_connect_anonymous_app_secret');?>";
33
+ // OAuth 2.0 Popup
34
+ //
35
+ var popupWindow=null;
36
+ function openPopup(url)
37
+ {
38
+ if(popupWindow && !popupWindow.closed) popupWindow.focus();
39
+ else popupWindow = window.open(url,"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=515, height=330,top=" + (screen.height - 330)/2 + ",left=" + (screen.width - 515)/2);
40
+ }
41
+ function parent_disable() {
42
+ if(popupWindow && !popupWindow.closed) popupWindow.focus();
43
+ }
44
+ $("a.monetize").click(function() {
45
+ if(app_id.length > 0) {
46
+ $.ajax({
47
+ url: resourceHost + '/api/v1/wp-monetize/'
48
+ , method: 'POST'
49
+ , data: {
50
+ app_id: $('[name="readygraph_application_id"]').val(),
51
+ monetize: "true",
52
+ client_id: settings.clientId
53
+ }
54
+ , success: function (response) {
55
+ var monetize_adsoptimal_id = response.data.adsoptimal_id;
56
+ var monetize_adsoptimal_secret = response.data.adsoptimal_secret;
57
+ jQuery.post(ajaxurl,{action : 's2-myajax-submit',readygraph_monetize : "true",adsoptimal_id : monetize_adsoptimal_id, adsoptimal_secret : monetize_adsoptimal_secret},function() {});
58
+ /* future processing for sites opted in for monetization */
59
+ }
60
+ , error: function (response) {
61
+ console.log(response);
62
+ /* future process */
63
+ }
64
+ });}
65
+ 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;
66
+ openPopup(url);
67
+ $(document.body).bind('focus', parent_disable);
68
+ $(document.body).bind('click', parent_disable);
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);
88
+ });
89
+ $(".change-account").click(function() {
90
+ document.cookie="readygraph_tutorial=true"
91
+ var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
92
+ var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
93
+ openPopup(logout);
94
+ $(document.body).bind('focus', parent_disable);
95
+ $(document.body).bind('click', parent_disable);
96
+ });
97
+
98
+ // User Interface
99
+ //
100
+ $('.template').click(function() {
101
+ $('#preview').attr('src', $(this).find('img').attr('src'));
102
+ });
103
+
104
+ // Manage OAuth 2.0 Redirect
105
+ //
106
+ var extractCode = function(hash) {
107
+ var match = hash.match(/code=(\w+)/);
108
+ return !!match && match[1];
109
+ };
110
+ var extractToken = function(hash) {
111
+ var match = hash.match(/access_token=(\w+)/);
112
+ return !!match && match[1];
113
+ };
114
+ var extractError = function(hash) {
115
+ var match = hash.match(/error=(\w+)/);
116
+ return !!match && match[1];
117
+ };
118
+
119
+ var code = extractCode(window.location.href);
120
+ if (extractError(window.location.href) == 'access_denied') {
121
+ window.close();
122
+ }
123
+ else if(code) {
124
+ try { window.opener.setCode(code); }
125
+ catch(ex) { }
126
+ window.close();
127
+ }
128
+ else {
129
+ $('.rgw-fb-login-button-iframe').hide();
130
+ $('div.authenticate').show();
131
+
132
+ if ($('[name="readygraph_access_token"]').val()) {
133
+ $('.rgw-fb-login-button-iframe').show();
134
+ $('div.authenticate').hide();
135
+ $('div.authenticating').hide();
136
+ $('div.authenticated').show();
137
+
138
+ $('.email-address').text($('[name="readygraph_email"]').val());
139
+
140
+ window.setup_readygraph($('[name="readygraph_application_id"]').val());
141
+ $('.popup-delay').val($('[name="readygraph_delay"]').val());
142
+ if ($('[name="readygraph_enable_popup"]').val() == "true"){
143
+ $('.signup-popup').val('yes-center');
144
+ }
145
+ else if ($('[name="readygraph_enable_notification"]').val() == "true"){
146
+ $('.signup-popup').val('yes-bottom-right');
147
+ }
148
+ else{
149
+ $('.signup-popup').val('no');
150
+ }
151
+ $('.delay').val($('[name="readygraph_delay"]').val());
152
+ $('.notification').val($('[name="readygraph_enable_notification"]').val());
153
+ $('.selectAll').val($('[name="readygraph_auto_select_all"]').val());
154
+ $('.branding').val($('[name="readygraph_enable_branding"]').val());
155
+ $('.blog_updates').val($('[name="readygraph_send_blog_updates"]').val());
156
+ $('.real_time_post_update').val($('[name="readygraph_send_real_time_post_updates"]').val());
157
+ $('.popup_template').val($('[name="readygraph_popup_template"]').val());
158
+ $('.result').text('...');
159
+ if ($('[name="readygraph_access_token"]').val()) {
160
+ $.ajax({
161
+ url: resourceHost + '/api/v1/insight_info'
162
+ , beforeSend: function (xhr) {
163
+ xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
164
+ xhr.setRequestHeader('Accept', "application/json");
165
+ }
166
+ , method: 'POST'
167
+ , success: function (response) {
168
+ if (response.data) {
169
+ $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
170
+ $('.user_tier').text(((response.data.user_tier > 0) ? ' Premium User ' : ' Free User '));
171
+
172
+ } else {
173
+ $('.result').text('Insight');
174
+ $('.result').text(' Free User ');
175
+ }
176
+ }
177
+ , error: function (response) {
178
+ refresh_access_token();
179
+ }
180
+ });
181
+ }
182
+ }
183
+ }
184
+
185
+ // Manage OAuth 2.0 Results
186
+ //
187
+ function refresh_access_token() {
188
+ var refresh_token = $('[name="readygraph_refresh_token"]').val();
189
+ if (refresh_token) {
190
+ $('div.authenticate').hide();
191
+ $('div.authenticating').show();
192
+ $('div.authenticated').hide();
193
+
194
+ $.ajax({
195
+ url: resourceHost + '/oauth/access_token'
196
+ , data: {
197
+ grant_type: 'refresh_token',
198
+ refresh_token: $('[name="readygraph_refresh_token"]').val(),
199
+ redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
200
+ client_id: settings.clientId
201
+ }
202
+ , method: 'POST'
203
+ , success: function (response) {
204
+ $('[name="readygraph_access_token"]').val(response.access_token);
205
+ $('[name="readygraph_refresh_token"]').val(response.refresh_token);
206
+ window.setAccessToken(response.access_token);
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();
214
+ }
215
+ });
216
+ }
217
+ }
218
+ window.setCode = function(code) {
219
+ $('.rgw-fb-login-button-iframe').hide();
220
+ $('div.authenticate').hide();
221
+ $('div.authenticating').show();
222
+ $('div.authenticated').hide();
223
+
224
+ $.ajax({
225
+ url: resourceHost + '/oauth/access_token'
226
+ , data: {
227
+ grant_type: 'authorization_code',
228
+ code: code,
229
+ redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
230
+ client_id: settings.clientId
231
+ }
232
+ , method: 'POST'
233
+ , success: function (response) {
234
+ if (response) {
235
+ $('[name="readygraph_access_token"]').val(response.access_token);
236
+ $('[name="readygraph_refresh_token"]').val(response.refresh_token);
237
+ window.setAccessToken(response.access_token);
238
+ } else {
239
+ $('div.authenticating').hide();
240
+ $('div.authenticate').show();
241
+ }
242
+ }
243
+ });
244
+ }
245
+ window.setAccessToken = function(token) {
246
+ $('.rgw-fb-login-button-iframe').hide();
247
+ $('div.authenticate').hide();
248
+ $('div.authenticating').show();
249
+ $('div.authenticated').hide();
250
+
251
+ $.ajax({
252
+ url: resourceHost + '/api/v1/account_info'
253
+ , beforeSend: function (xhr) {
254
+ xhr.setRequestHeader('Authorization', "Bearer " + token);
255
+ xhr.setRequestHeader('Accept', "application/json");
256
+ }
257
+ , method: 'POST'
258
+ , success: function (response) {
259
+ if (response.data) {
260
+ $('[name="readygraph_access_token"]').val(token);
261
+ $('[name="readygraph_email"]').val(response.data.email);
262
+ $('[name="readygraph_application_id"]').val(response.data.application_id);
263
+ $('#myForm')[0].submit();
264
+ } else {
265
+ $('div.authenticating').hide();
266
+ $('div.authenticate').show();
267
+ $('.rgw-fb-login-button-iframe').hide();
268
+ }
269
+ }
270
+ });
271
+ }
272
+ });
273
+ </script>
274
+ <script>
275
+ window.setup = false;
276
+ window.refresh_readygraph = function() {};
277
+ window.setup_readygraph = function(app_id) {
278
+ if (window.setup) {
279
+ window.refresh_readygraph();
280
+ return;
281
+ }
282
+ window.setup = true;
283
+ readygraph.setup({
284
+ applicationId: app_id,
285
+ isPreview: true,
286
+ enableLoginWall: false,
287
+ enableDistraction: false,
288
+ enableAutoLogin: false,
289
+ enableSidebar: false,
290
+ enableNotification: false,
291
+ enableInvite: false,
292
+ enableOpenGraph: false,
293
+ enableRgSeo: false
294
+ });
295
+ readygraph.ready(function() {
296
+ readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
297
+ var $ = readygraph.framework.jQuery;
298
+ $.cookie('RGAuth', null);
299
+ readygraph.framework.facebook.logout(function() {
300
+ readygraph.framework.require(['invite'], function() {
301
+ var VIEW_TYPE = {
302
+ LOADING: 0,
303
+ LOGIN_REQUIRE: 1,
304
+ PERMISSION_REQUIRE: 2,
305
+ DEFAULT: 3,
306
+ LOGIN_WITH_EMAIL: 4,
307
+ SIGNUP_WITH_EMAIL: 5,
308
+ IMPORT_WITH_EMAIL: 6,
309
+ FINISH: 10
310
+ };
311
+
312
+ var auth = new readygraph.framework.ui.AuthModel({
313
+ dialog: true,
314
+ 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
315
+ });
316
+ $('.rg-preview-widget').html('');
317
+ $('.rg-preview-widget').append(auth.lightbox.view.$el);
318
+ $('.rgw-content').attr('style', 'position: relative !important;');
319
+
320
+ var view = VIEW_TYPE.LOGIN_REQUIRE;
321
+ auth.on('switch', function() {
322
+ if (auth.view.currentView != view) { auth.view.switchView(view); }
323
+ else auth.view.render();
324
+ if (view == VIEW_TYPE.DEFAULT) {
325
+ auth.view.$el.find('.rgw-invite-view').showAndAnimate();
326
+ auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
327
+ auth.view.$el.commitTransition();
328
+ }
329
+ });
330
+ auth.view.switchView(view);
331
+
332
+ $(window).scroll(function() {
333
+ $(window).trigger('rgw-invalidate');
334
+ });
335
+ $('.rg-preview-widget, .content-warp').scroll(function() {
336
+ $(window).trigger('rgw-invalidate');
337
+ });
338
+ $(window).trigger('rgw-invalidate');
339
+
340
+ $('.rg-vertical-tab').click(function() {
341
+ saveContent(auth, $('.rg-preview-widget-container'), true);
342
+
343
+ $('.rg-vertical-tab').removeClass('active');
344
+ $(this).addClass('active');
345
+ view = VIEW_TYPE[$(this).attr('tab')];
346
+ if (auth.view.currentView != view) { auth.view.switchView(view); }
347
+
348
+ $('.rg-preview-widget, .content-warp').scrollTop(10000);
349
+ });
350
+
351
+ enableContentEditable(auth, $('.rg-preview-widget-container'));
352
+ restoreContent(auth, $('.rg-preview-widget-container'));
353
+
354
+ $('.save').click(function() {
355
+ $('.save').css('opacity', 0.4);
356
+ saveContent(auth, $('.rg-preview-widget-container'), false);
357
+ });
358
+
359
+ window.refresh_readygraph = function() {
360
+ restoreContent(auth, $('.rg-preview-widget-container'));
361
+ }
362
+ });
363
+ });
364
+ });
365
+ });
366
+ }
367
+ function enableContentEditable(model, container) {
368
+ model.view.$el.find('[rgw-data-key]').each(function() {
369
+ var element = $(this);
370
+ if (element.attr('rgw-data-editable') == 'false') return;
371
+
372
+ if (element.attr('editing') != null) return;
373
+ container.find('.special-button-container button').attr('disabled', 'disabled');
374
+ element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
375
+ element.attr('editing', '1');
376
+ element.css({
377
+ 'border': '2px dashed orange',
378
+ 'position': 'relative',
379
+ 'top': '-2px',
380
+ 'margin-bottom': '-4px',
381
+ 'background-color': '#FAFAC5'
382
+ });
383
+ element.attr('contenteditable', true);
384
+ element.bind('paste', function(e) {
385
+ e.preventDefault();
386
+ });
387
+ element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
388
+ });
389
+ }
390
+ function saveContent(model, container, fake) {
391
+ var settings = {};
392
+ model.view.$el.find('[rgw-data-key]').each(function() {
393
+ var element = $(this);
394
+ if (element.attr('rgw-data-editable') == 'false') return;
395
+ settings[element.attr('rgw-data-key')] = element.text();
396
+ readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
397
+ });
398
+ if (!fake) {
399
+ $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
400
+ $('#myForm')[0].submit();
401
+ }
402
+ }
403
+ function restoreContent(model, container) {
404
+ eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
405
+ var settings = window._TEMP;
406
+ if (settings) {
407
+ model.view.$el.find('[rgw-data-key]').each(function() {
408
+ var element = $(this);
409
+ if (element.attr('rgw-data-editable') == 'false') return;
410
+ element.text(settings[element.attr('rgw-data-key')]);
411
+ readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
412
+ });
413
+ }
414
+ }
415
+ </script>
416
+ <style>
417
+ /* FOR INLINE WIDGET */
418
+ .rgw-overlay {
419
+ display: none !important;
420
+ }
421
+ .rgw-content-frame {
422
+ left: 0 !important;
423
+ top: 0 !important;
424
+ position: relative !important;
425
+ margin: 0 auto !important;
426
+ border: solid 1px #cccccc;
427
+ }
428
+ .rgw-preview-warning {
429
+ display: none !important;
430
+ }
431
+ .rgw-content {
432
+ position: relative !important;
433
+ }
434
+ </style>
extension/readygraph/functions.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ /**
5
+ * Represents the view for the administration dashboard.
6
+ *
7
+ * This includes the header, options, and other information that should provide
8
+ * The User Interface to the end user.
9
+ *
10
+ * @package ReadyGraph
11
+ * @author dan@readygraph.com
12
+ * @license GPL-2.0+
13
+ * @link http://www.readygraph.com
14
+ * @copyright 2014 Your Name or Company Name
15
+ */
16
+
17
+ function s2_disconnectReadyGraph(){
18
+ $app_id = get_option('readygraph_application_id');
19
+ wp_remote_get( "http://readygraph.com/api/v1/tracking?event=disconnect_readygraph&app_id=$app_id" );
20
+ s2_delete_rg_options();
21
+ echo '<div class="updated"><p>We are sorry to see you go. ReadyGraph is now disconnected.</p></div>';
22
+ }
23
+ function s2_deleteReadyGraph(){
24
+ $app_id = get_option('readygraph_application_id');
25
+ update_option('readygraph_deleted', 'true');
26
+ wp_remote_get( "http://readygraph.com/api/v1/tracking?event=uninstall_readygraph&app_id=$app_id" );
27
+ s2_delete_rg_options();
28
+ $dir = plugin_dir_path( __FILE__ );
29
+ s2_rrmdir($dir);
30
+ }
31
+ function s2_readygraph_monetize_update(){
32
+ $app_id = get_option('readygraph_application_id');
33
+ $email = get_option('readygraph_monetize_email');
34
+ $monetize = get_option('readygraph_enable_monetize');
35
+ $url = 'https://readygraph.com/api/v1/wp-monetize/';
36
+ $response = wp_remote_post($url, array( 'body' => array('app_id' => $app_id, 'monetize_email' => $email, 'monetize' => $monetize)));
37
+ if ( is_wp_error( $response ) ) {
38
+ } else {
39
+ $json_decoded = json_decode($response['body'],true);
40
+ if (array_key_exists('adsoptimal_id', $json_decoded['data'])) {
41
+ update_option('readygraph_adsoptimal_id', $json_decoded['data']['adsoptimal_id']);
42
+ } if (array_key_exists('adsoptimal_secret', $json_decoded['data'])) {
43
+ update_option('readygraph_adsoptimal_secret', $json_decoded['data']['adsoptimal_secret']);
44
+ }
45
+ }
46
+ }
47
+ function s2_siteprofile_sync(){
48
+ $app_id = get_option('readygraph_application_id');
49
+ $email = get_option('readygraph_email');
50
+ $site_name = get_option('readygraph_site_name');
51
+ $site_url = get_option('readygraph_site_url');
52
+ $site_description = get_option('readygraph_site_description');
53
+ $site_category = get_option('readygraph_site_category');
54
+ $site_language = get_option('readygraph_site_language');
55
+ $url = 'https://readygraph.com/api/v1/wordpress-sync-siteprofile/';
56
+ $response = wp_remote_post($url, array( 'body' => array('app_id' => $app_id, 'email' => $email, 'site_profile_name' => $site_name, 'site_profile_url' => $site_url, 'site_description' => $site_description, 'site_category' => $site_category, 'site_language' => $site_language)));
57
+ }
58
+
59
+ ?>
extension/readygraph/go-premium.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+ /**
4
+ * Represents the view for the administration dashboard.
5
+ *
6
+ * This includes the header, options, and other information that should provide
7
+ * The User Interface to the end user.
8
+ *
9
+ * @package ReadyGraph
10
+ * @author dan@readygraph.com
11
+ * @license GPL-2.0+
12
+ * @link http://www.readygraph.com
13
+ * @copyright 2014 Your Name or Company Name
14
+ */
15
+ include("header.php");
16
+
17
+ if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
18
+ }
19
+ else {
20
+ if (isset($_POST["readygraph_access_token"])) update_option('readygraph_access_token', $_POST["readygraph_access_token"]);
21
+ if (isset($_POST["readygraph_refresh_token"])) update_option('readygraph_refresh_token', $_POST["readygraph_refresh_token"]);
22
+ if (isset($_POST["readygraph_email"])) update_option('readygraph_email', $_POST["readygraph_email"]);
23
+ if (isset($_POST["readygraph_application_id"])) update_option('readygraph_application_id', $_POST["readygraph_application_id"]);
24
+ if (isset($_POST["readygraph_settings"])) update_option('readygraph_settings', $_POST["readygraph_settings"]);
25
+ if (isset($_POST["retentionemaileditor"])) update_option('readygraph_invite_email', $_POST["retentionemaileditor"]);
26
+ }
27
+ ?>
28
+
29
+
30
+ <form method="post" id="myForm">
31
+ <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
32
+ <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
33
+ <input type="hidden" name="readygraph_email" value="<?php echo get_option('readygraph_email', '') ?>">
34
+ <input type="hidden" name="readygraph_application_id" value="<?php echo get_option('readygraph_application_id', '') ?>">
35
+ <input type="hidden" name="readygraph_settings" value="<?php echo htmlentities(str_replace("\\\"", "\"", get_option('readygraph_settings', '{}'))) ?>">
36
+ <input type="hidden" name="readygraph_delay" value="<?php echo get_option('readygraph_delay', '5000') ?>">
37
+ <input type="hidden" name="readygraph_enable_sidebar" value="<?php echo get_option('readygraph_enable_sidebar', 'false') ?>">
38
+ <input type="hidden" name="readygraph_enable_notification" value="<?php echo get_option('readygraph_enable_notification', 'true') ?>">
39
+ <input type="hidden" name="readygraph_auto_select_all" value="<?php echo get_option('readygraph_auto_select_all', 'true') ?>">
40
+ <input type="hidden" name="readygraph_enable_branding" value="<?php echo get_option('readygraph_enable_branding', 'false') ?>">
41
+ <input type="hidden" name="readygraph_send_blog_updates" value="<?php echo get_option('readygraph_send_blog_updates', 'true') ?>">
42
+ <input type="hidden" name="readygraph_send_real_time_post_updates" value="<?php echo get_option('readygraph_send_real_time_post_updates', 'false') ?>">
43
+ <input type="hidden" name="readygraph_popup_template" value="<?php echo get_option('readygraph_popup_template', 'default-template') ?>">
44
+
45
+ <div style="margin: 3% 5%">
46
+ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/15.png" style="float: right;margin-left: 10%;" width="310px" height="350px">
47
+ <h3><strong>Effortlessly Increase Your Site's Userbase</strong></h3>
48
+
49
+ <h4> Scale your audience faster with our Premium Growth Features:</h4>
50
+ <div style="width: 60%;">
51
+ <h4 class="rg-h4"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/round-check.png" class="rg-small-icon"/>Your site promoted to 10,000 New Users Every Month in our Community Email Update</h4>
52
+ <h4 class="rg-h4"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/round-check.png" class="rg-small-icon"/>Unlimited Viral Email/Facebook Invites</h4>
53
+ <h4 class="rg-h4"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/round-check.png" class="rg-small-icon"/>Unlimited Blog Post Notifications</h4>
54
+ <h4 class="rg-h4"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/round-check.png" class="rg-small-icon"/>Premium Phone/Email Support</h4>
55
+ <h4 class="rg-h4"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/round-check.png" class="rg-small-icon"/>More Premium Features Added All The Time!</h4>
56
+ <br>
57
+ <a href="https://readygraph.com/accounts/payment/?email=<?php echo get_option('readygraph_email', '') ?>" target="_blank"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/go-premium.png" height="40px" style="margin:5px"/></a>
58
+ </div>
59
+ <div style="margin: 65px 0; width: 100%; display: block;">
60
+ <div class="rg-three-column" style="float: left">
61
+ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/12.png" height="40px" style="margin:15px"/>Explosive Website Growth
62
+ </div>
63
+ <div class="rg-three-column" style="float: left">
64
+ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/13.png" height="40px" style="margin:15px"/>Develop a Community of Users
65
+ </div>
66
+ <div class="rg-three-column" style="float: left">
67
+ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/14.png" height="40px" style="margin:15px"/>Track Growth with Powerful Analytics
68
+ </div>
69
+ </div>
70
+ <p><h4 class="rg-h4">ReadyGraph Premium equips your Wordpress site with the industry's most powerful proven growth features. Websites have used our tools to increase their growth rate by upto 70X.</h4></p>
71
+ <p><h4 class="rg-h4">Don't keep keep your website a secret! Set your growth to "full-blast" with ReadyGraph.</h4> </p>
72
+ <p><h4 class="rg-h4"><a target="_blank" href="https://readygraph.com/accounts/payment/?email=<?php echo get_option('readygraph_email', '') ?>">Start A Free Trial Today!</a> </h4></p>
73
+
74
+ </div>
75
+
76
+ </form>
77
+ <?php include("footer.php"); ?>
extension/readygraph/header.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+ /**
4
+ * Represents the view for the administration dashboard.
5
+ *
6
+ * This includes the header, options, and other information that should provide
7
+ * The User Interface to the end user.
8
+ *
9
+ * @package ReadyGraph
10
+ * @author dan@readygraph.com
11
+ * @license GPL-2.0+
12
+ * @link http://www.readygraph.com
13
+ * @copyright 2014 Your Name or Company Name
14
+ */
15
+ include("functions.php");
16
+ if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "changeaccount")s2_disconnectReadyGraph();
17
+ if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "deleteaccount")s2_deleteReadyGraph();
18
+ if(isset($_GET["readygraph_upgrade_notice"]) && $_GET["readygraph_upgrade_notice"] == "dismiss") {update_option('readygraph_upgrade_notice', 'false');}
19
+ global $s2_main_plugin_title;
20
+ if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
21
+ if (isset($_POST["readygraph_access_token"])) update_option('readygraph_access_token', $_POST["readygraph_access_token"]);
22
+ if (isset($_POST["readygraph_refresh_token"])) update_option('readygraph_refresh_token', $_POST["readygraph_refresh_token"]);
23
+ if (isset($_POST["readygraph_email"])) update_option('readygraph_email', $_POST["readygraph_email"]);
24
+ if (isset($_POST["readygraph_application_id"])){ update_option('readygraph_application_id', $_POST["readygraph_application_id"]);}
25
+ if (isset($_POST["readygraph_settings"])) update_option('readygraph_settings', $_POST["readygraph_settings"]);
26
+ if (isset($_POST["readygraph_delay"])) update_option('readygraph_delay', 10000);
27
+ if (isset($_POST["readygraph_enable_notification"])) update_option('readygraph_enable_notification', 'true');
28
+ if (isset($_POST["readygraph_enable_popup"])) update_option('readygraph_enable_popup', 'true');
29
+ update_option('readygraph_enable_sidebar', 'false');
30
+ update_option('readygraph_auto_select_all', 'true');
31
+ update_option('readygraph_enable_branding', 'false');
32
+ update_option('readygraph_send_blog_updates', 'true');
33
+ update_option('readygraph_send_real_time_post_updates', 'false');
34
+ update_option('readygraph_popup_template', 'default-template');
35
+ update_option('readygraph_upgrade_notice', 'true');
36
+ update_option('readygraph_tutorial',"true");
37
+ $site_url = site_url();
38
+ update_option('readygraph_site_url', $site_url);
39
+ } else {
40
+ }
41
+ ?>
42
+ <link rel="stylesheet" type="text/css" href="<?php echo plugins_url( 'assets/css/admin.css', __FILE__ ) ?>">
43
+ <style>a.help-tooltip {outline:none; }a.help-tooltip strong {line-height:30px;}a.help-tooltip:hover {text-decoration:none;} a.help-tooltip span { z-index:10;display:none; padding:14px 20px; margin-top:40px; margin-left:-150px; width:300px; line-height:16px;}a.help-tooltip:hover span{ display:inline; position:absolute; border:2px solid #FFF; background:#fff; text-align: justify; z-index:1000000000;}.callout {z-index:1000000000;position:absolute;border:0;top:-14px;left:120px;} /*CSS3 extras*/a.help-tooltip span{ border-radius:2px; -moz-border-radius: 2px; -webkit-border-radius: 2px; -moz-box-shadow: 0px 0px 8px 4px #666; -webkit-box-shadow: 0px 0px 8px 4px #666; box-shadow: 0px 0px 8px 4px #666;}</style>
44
+ <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/admin.js', __FILE__ ) ?>"></script>
45
+
46
+ <?php if (get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) > 0){ ?>
47
+ <div style="background-color: #2691CB; min-width: 90%; height: 50px;margin-right: 1%;">
48
+ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/white-logo.png" style="width: 138px; height: 30px; margin: 10px 0 0 15px; float: left;">
49
+ <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
50
+ <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
51
+ <span class="email-address" style="text-shadow: none;"></span> <span class="caret"></span>
52
+ </button>
53
+ <ul class="dropdown-menu">
54
+ <li><a class="change-account" href="#">Change Account</a></li>
55
+ <li><a class="disconnect" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("changeaccount");?>">Disconnect</a></li>
56
+ <li><a class="delete" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("deleteaccount");?>">Delete ReadyGraph</a></li>
57
+ </ul>
58
+ </div>
59
+ <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
60
+ <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
61
+ <span class="result" style="text-shadow: none;">...</span> <span class="caret"></span>
62
+ </button>
63
+ <ul class="dropdown-menu">
64
+ <li><a href="http://readygraph.com/application/insights/" target="_blank">Insights</a></li>
65
+ </ul>
66
+ </div>
67
+ <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
68
+ <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
69
+ <span class="user_tier" style="text-shadow: none;">...</span>
70
+ </button>
71
+ </div>
72
+ <div style="clear: both;"></div>
73
+ </div>
74
+ <!-- write menu code-->
75
+
76
+ <div class="readygraph-nav-menu">
77
+
78
+ <ul><li>Grow Users
79
+ <ul>
80
+ <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
81
+ <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
82
+ <li><a href="#"></a></li>
83
+ </ul>
84
+ </li>
85
+ <li>Email Users
86
+ <ul>
87
+ <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
88
+ <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
89
+ <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
90
+ </ul>
91
+ </li>
92
+ <li>
93
+ Engage Users
94
+ <ul>
95
+ <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed">Social Feed</a></li>
96
+ <li><a href="#">Social Followers</a></li>
97
+ <li><a href="#">Feedback Survey</a></li>
98
+ </ul>
99
+ </li>
100
+ <li>Basic Settings
101
+ <ul>
102
+ <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
103
+ <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=feature-settings">Feature Settings</a></li>
104
+ <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=monetization-settings">Monetization Settings</a></li>
105
+ </ul>
106
+ </li>
107
+ </ul>
108
+
109
+ <div class="btn-group" style="margin: 8px 10px 0 10px;">
110
+ <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
111
+ </div>
112
+ <div class="btn-group" style="margin: 8px 10px 0 10px;">
113
+ <p>
114
+ <a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=faq" style="color: #b1c1ca" >FAQ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/10.png" /></a></p>
115
+ </div>
116
+ <div class="btn-group" style="">
117
+ <p><a href="https://readygraph.com/accounts/payment/?email=<?php echo get_option('readygraph_email', '') ?>" target="_blank" style="color: #b1c1ca" ><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/go-premium.png" height="40px" style="margin:5px" /></a></p>
118
+ </div>
119
+ </div>
120
+ <?php } else { ?>
121
+ <div style="clear;both;float:right;display:block;width: 10%; height: 50px;margin-right: 3.5%;z-index:999999">
122
+ <div class="btn-group pull-right" style="margin: 15px 10px 0 0;z-index:999999">
123
+ <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: rgb(66, 139, 202); border-color: #ffffff; color: #ffffff;z-index:999999 ">
124
+ <span class="email-address" style="text-shadow: none;">Settings</span> <span class="caret"></span>
125
+ </button>
126
+ <ul class="dropdown-menu">
127
+ <li><a class="delete" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("deleteaccount");?>">Delete ReadyGraph</a></li>
128
+ </ul>
129
+ </div>
130
+
131
+ </div>
132
+
133
+ <?php } ?>
extension/readygraph/index.php CHANGED
@@ -1 +1,2 @@
1
- <?php // Silence is golden
 
1
+ <?php // Silence is golden
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
extension/readygraph/invitation-email-not-used.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Represents the view for the administration dashboard.
4
  *
@@ -121,35 +122,47 @@ If you have questions or concerns contact us anytime at <a href="mailto:info@rea
121
  </div>
122
  <div style="clear: both;"></div>
123
  </div>
124
- <!-- write menu code-->
125
- <div class="readygraph-menu" style="margin-right: 1%;height:165px;">
126
- <div class="menu-tabs"><h4>Grow Users</h4>
127
- <ul>
128
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
129
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
130
- <li><a href="#"></a></li>
131
- </ul>
132
- </div>
133
- <div class="menu-tabs"><h4>Email Users</h4>
134
- <ul>
135
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
136
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
137
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
138
- </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  </div>
140
- <div class="menu-tabs"><h4>Engage Users</h4>
141
- <ul>
142
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed">Social Feed</a></li>
143
- <li><a href="#">Social Followers</a></li>
144
- <li><a href="#">Feedback Survey</a></li>
145
- </ul>
146
  </div>
147
- <div class="menu-tabs"><h4>Basic Settings</h4>
148
- <ul>
149
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
150
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=feature-settings">Feature Settings</a></li>
151
-
152
- </ul>
153
  </div>
154
  </div>
155
  <div><div><a href="#">Email</a> > Invitation Email</div>
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
  /**
4
  * Represents the view for the administration dashboard.
5
  *
122
  </div>
123
  <div style="clear: both;"></div>
124
  </div>
125
+ <!-- write menu code-->
126
+
127
+ <div class="readygraph-nav-menu">
128
+ <ul><li>Grow Users
129
+ <ul>
130
+ <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
131
+ <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
132
+ <li><a href="#"></a></li>
133
+ </ul>
134
+ </li>
135
+ <li>Email Users
136
+ <ul>
137
+ <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
138
+ <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
139
+ <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
140
+ </ul>
141
+ </li>
142
+ <li>
143
+ Engage Users
144
+ <ul>
145
+ <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed">Social Feed</a></li>
146
+ <li><a href="#">Social Followers</a></li>
147
+ <li><a href="#">Feedback Survey</a></li>
148
+ </ul>
149
+ </li>
150
+ <li>Basic Settings
151
+ <ul>
152
+ <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
153
+ <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=feature-settings">Feature Settings</a></li><li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=monetization-settings">Monetization Settings</a></li>
154
+ </ul>
155
+ </li>
156
+ </ul>
157
+ <div class="btn-group" style="margin: 8px 10px 0 10px;">
158
+ <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
159
  </div>
160
+ <div class="btn-group" style="margin: 8px 10px 0 10px;">
161
+ <p>
162
+ <a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=faq" style="color: #b1c1ca" >FAQ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/10.png" /></a></p>
 
 
 
163
  </div>
164
+ <div class="btn-group" style="">
165
+ <p><a href="https://readygraph.com/accounts/payment/?email=<?php echo get_option('readygraph_email', '') ?>" target="_blank" style="color: #b1c1ca" ><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/go-premium.png" height="40px" style="margin:5px" /></a></p>
 
 
 
 
166
  </div>
167
  </div>
168
  <div><div><a href="#">Email</a> > Invitation Email</div>
extension/readygraph/monetization.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+ /**
4
+ * Represents the view for the administration dashboard.
5
+ *
6
+ * This includes the header, options, and other information that should provide
7
+ * The User Interface to the end user.
8
+ *
9
+ * @package ReadyGraph
10
+ * @author dan@readygraph.com
11
+ * @license GPL-2.0+
12
+ * @link http://www.readygraph.com
13
+ * @copyright 2014 Your Name or Company Name
14
+ */
15
+ include("header.php");
16
+
17
+
18
+ if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
19
+ }
20
+ else {
21
+ if (isset($_POST["readygraph_access_token"])) update_option('readygraph_access_token', $_POST["readygraph_access_token"]);
22
+ if (isset($_POST["readygraph_refresh_token"])) update_option('readygraph_refresh_token', $_POST["readygraph_refresh_token"]);
23
+ if (isset($_POST["readygraph_email"])) update_option('readygraph_email', $_POST["readygraph_email"]);
24
+ if (isset($_POST["readygraph_application_id"])) update_option('readygraph_application_id', $_POST["readygraph_application_id"]);
25
+ }
26
+ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
27
+ if (isset($_POST["readygraph_monetize"]) && $_POST["readygraph_monetize"] == "1") update_option('readygraph_enable_monetize', "true");
28
+ else update_option('readygraph_enable_monetize', "false");
29
+ if (isset($_POST["readygraph_monetize_email"])) update_option('readygraph_monetize_email', $_POST["readygraph_monetize_email"]);
30
+ s2_readygraph_monetize_update();
31
+ }
32
+ ?>
33
+
34
+ <form method="post" id="myForm">
35
+ <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
36
+ <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
37
+ <input type="hidden" name="readygraph_email" value="<?php echo get_option('readygraph_email', '') ?>">
38
+ <input type="hidden" name="readygraph_application_id" value="<?php echo get_option('readygraph_application_id', '') ?>">
39
+ <input type="hidden" name="readygraph_settings" value="<?php echo htmlentities(str_replace("\\\"", "\"", get_option('readygraph_settings', '{}'))) ?>">
40
+ <input type="hidden" name="readygraph_delay" value="<?php echo get_option('readygraph_delay', '5000') ?>">
41
+ <input type="hidden" name="readygraph_enable_sidebar" value="<?php echo get_option('readygraph_enable_sidebar', 'false') ?>">
42
+ <input type="hidden" name="readygraph_enable_notification" value="<?php echo get_option('readygraph_enable_notification', 'true') ?>">
43
+ <input type="hidden" name="readygraph_auto_select_all" value="<?php echo get_option('readygraph_auto_select_all', 'true') ?>">
44
+ <input type="hidden" name="readygraph_enable_branding" value="<?php echo get_option('readygraph_enable_branding', 'false') ?>">
45
+ <input type="hidden" name="readygraph_send_blog_updates" value="<?php echo get_option('readygraph_send_blog_updates', 'true') ?>">
46
+ <input type="hidden" name="readygraph_send_real_time_post_updates" value="<?php echo get_option('readygraph_send_real_time_post_updates', 'false') ?>">
47
+ <input type="hidden" name="readygraph_popup_template" value="<?php echo get_option('readygraph_popup_template', 'default-template') ?>">
48
+
49
+ <div style="margin: 3% 5%">
50
+ <?php if(get_option('readygraph_enable_monetize') && get_option('readygraph_enable_monetize') == "true") { ?><h3 style="font-weight: normal; text-align: center;"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/check.png"/>Congratulations! <?php echo $s2_main_plugin_title; ?>'s ReadyGraph monetization engine is now active.</h3><?php } ?>
51
+ <h3><strong>Adjust Revenue Settings</strong></h3>
52
+
53
+ <div style="width: 60%;">
54
+ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/round-check.png" style="float: left; height: 20px; vertical-align: middle;"/><h5 class="rg-h4" style="margin-left: 30px;text-align:justify; line-height: 20px;">Note: To view your revenue stats, adjust ad placements, and request payment, please click the button below. This will take you to your dashboard page powered by our monetization partner AdsOptimal. Please contact us <a href="mailto:info@readygraph.com">info@readygraph.com</a> anytime if you have questions. If you no longer wish to monetize via our non-intrusive highly optimized ad units, you can turn off monetization below. Remember to save your changes!</h5>
55
+
56
+ <br>
57
+ <div style="display: block; margin: 10px;"><label for="readygraph_monetize_email">Email:</label><input type="text" name="readygraph_monetize_email" id="readygraph_monetize_email" value="<?php echo get_option('readygraph_monetize_email');?>" style="display: inline; margin: 0 0 0 20px" /></div>
58
+ <p><input type="checkbox" name="readygraph_monetize" value="1" style="margin: 0 10px;" <?php if(get_option('readygraph_enable_monetize') && get_option('readygraph_enable_monetize') == "true") echo "checked"; ?> >Enable Monetization</span>
59
+ <a href="#" class="help-tooltip"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/Help-icon.png" width="15px" style="margin-left:10px;"/><span><img class="callout" src="<?php echo plugin_dir_url( __FILE__ );?>assets/callout_black.gif" /><strong>ReadyGraph Monetization Settings</strong><br />You can check/uncheck this box to enable/disable the monetization settings for ReadyGraph<br /></span></a>
60
+ </p>
61
+ <div class="save-changes">
62
+ <a type="button" class="btn btn-large btn-warning" href="https://www.adsoptimal.com/api/v4/redirect/dashboard?adoid=<?php echo get_option('readygraph_adsoptimal_id', ''); ?>&secret=<?php echo get_option('readygraph_adsoptimal_secret', ''); ?>;" target="_blank" style="margin: 15px">View Revenue Dashboard</a><button type="submit" class="btn btn-large btn-warning save" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=monetization-settings" style="margin: 15px">Save Changes</button>
63
+ </div>
64
+
65
+ </div>
66
+
67
+ </div>
68
+
69
+ </form>
70
+ <?php include("footer.php"); ?>
extension/readygraph/signup-popup.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Represents the view for the administration dashboard.
4
  *
@@ -12,29 +13,16 @@
12
  * @copyright 2014 Your Name or Company Name
13
  */
14
 
15
- function s2_disconnectReadyGraph(){
16
- $app_id = get_option('readygraph_application_id');
17
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=disconnect_readygraph&app_id=$app_id" );
18
- s2_delete_rg_options();
19
- }
20
- function s2_deleteReadyGraph(){
21
- $app_id = get_option('readygraph_application_id');
22
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=uninstall_readygraph&app_id=$app_id" );
23
- s2_delete_rg_options();
24
- $dir = plugin_dir_path( __FILE__ );
25
- s2_rrmdir($dir);
26
- }
27
 
28
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "changeaccount")s2_disconnectReadyGraph();
29
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "deleteaccount")s2_deleteReadyGraph();
30
- global $main_plugin_title;
31
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
32
- //redirect to main page
33
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
34
  echo '<script>window.location.replace("'.$current_url[0].'");</script>';
35
  }
36
  else {
37
- if(isset($_GET["source"]) && $_GET["source"] == "signup-popup"){
38
 
39
  }
40
  else{
@@ -42,6 +30,13 @@ s2_rrmdir($dir);
42
  if (isset($_POST["readygraph_refresh_token"])) update_option('readygraph_refresh_token', $_POST["readygraph_refresh_token"]);
43
  if (isset($_POST["readygraph_email"])) update_option('readygraph_email', $_POST["readygraph_email"]);
44
  if (isset($_POST["readygraph_application_id"])) update_option('readygraph_application_id', $_POST["readygraph_application_id"]);
 
 
 
 
 
 
 
45
  if (isset($_POST["readygraph_settings"])) update_option('readygraph_settings', $_POST["readygraph_settings"]);
46
  if (isset($_POST["readygraph_delay"])) {
47
  update_option('readygraph_delay', $_POST["delay"]);
@@ -67,8 +62,6 @@ s2_rrmdir($dir);
67
  </style>
68
  <?php } ?>
69
 
70
- <link rel="stylesheet" type="text/css" href="<?php echo plugins_url( 'assets/css/admin.css', __FILE__ ) ?>">
71
- <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/admin.js', __FILE__ ) ?>"></script>
72
  <form method="post" id="myForm">
73
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
74
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
@@ -82,522 +75,99 @@ s2_rrmdir($dir);
82
  <input type="hidden" name="readygraph_send_blog_updates" value="<?php echo get_option('readygraph_send_blog_updates', 'true') ?>">
83
  <input type="hidden" name="readygraph_send_real_time_post_updates" value="<?php echo get_option('readygraph_send_real_time_post_updates', 'false') ?>">
84
  <input type="hidden" name="readygraph_popup_template" value="<?php echo get_option('readygraph_popup_template', 'default-template') ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
 
87
- <style>a.help-tooltip {outline:none; }a.help-tooltip strong {line-height:30px;}a.help-tooltip:hover {text-decoration:none;} a.help-tooltip span { z-index:10;display:none; padding:14px 20px; margin-top:40px; margin-left:-150px; width:300px; line-height:16px;}a.help-tooltip:hover span{ display:inline; position:absolute; border:2px solid #FFF; background:#fff; text-align: justify; z-index:1000000000;}.callout {z-index:1000000000;position:absolute;border:0;top:-14px;left:120px;} /*CSS3 extras*/a.help-tooltip span{ border-radius:2px; -moz-border-radius: 2px; -webkit-border-radius: 2px; -moz-box-shadow: 0px 0px 8px 4px #666; -webkit-box-shadow: 0px 0px 8px 4px #666; box-shadow: 0px 0px 8px 4px #666;}</style>
88
- <div class="authenticated" style="display: none;">
89
- <div style="background-color: #2961cb; min-width: 90%; height: 50px;margin-right: 1%;">
90
- <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/white-logo.png" style="width: 138px; height: 30px; margin: 10px 0 0 15px; float: left;">
91
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
92
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
93
- <span class="email-address" style="text-shadow: none;"></span> <span class="caret"></span>
94
- </button>
95
- <ul class="dropdown-menu">
96
- <li><a class="change-account" href="#">Change Account</a></li>
97
- <li><a class="disconnect" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("changeaccount");?>">Disconnect</a></li>
98
- <li><a class="delete" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("deleteaccount");?>">Delete ReadyGraph</a></li>
99
- </ul>
100
  </div>
101
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
102
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
103
- <span class="result" style="text-shadow: none;">...</span> <span class="caret"></span>
104
- </button>
105
- <ul class="dropdown-menu">
106
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Insights</a></li>
107
- </ul>
108
  </div>
109
- <div style="clear: both;"></div>
110
- </div>
111
- <!-- write menu code-->
112
- <div class="readygraph-menu">
113
- <div class="menu-tabs"><h4>Grow Users</h4>
114
- <ul>
115
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
116
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
117
- <li><a href="#"></a></li>
118
- </ul>
119
- </div>
120
- <div class="menu-tabs"><h4>Email Users</h4>
121
- <ul>
122
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
123
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
124
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
125
- </ul>
126
- </div>
127
- <div class="menu-tabs"><h4>Engage Users</h4>
128
- <ul>
129
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed">Social Feed</a></li>
130
- <li><a href="#">Social Followers</a></li>
131
- <li><a href="#">Feedback Survey</a></li>
132
- </ul>
133
  </div>
134
- <div class="menu-tabs"><h4>Basic Settings</h4>
135
- <ul>
136
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
137
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=feature-settings">Feature Settings</a></li>
138
-
139
- </ul>
140
- </div>
141
- <div class="menu-tabs" style="float:right"><h4>&nbsp;</h4>
142
- <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
143
- <p>
144
- <a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=faq" style="color: #b1c1ca" >FAQ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/10.png" /></a></p>
145
-
146
- </ul>
147
  </div>
148
  </div>
149
- <div><div><a href="#">Grow Users</a> > Signup Popup</div>
150
- <h3 style="font-weight: normal; text-align: center;">Increase signups with the Intelligent Signup Popup</h3>
151
- <h4 style="font-weight: normal; text-align: center;">Users instantly added to your list - One Click Signup - Automatically targets engaged users</h4>
152
- <div style="width: 90%; margin: 0 auto;">
153
- <div class="rg-vertical-tab-body-container" style="width: 50%; text-align: center;float: left">
154
- <div class="btn-group" data-toggle="buttons" style="padding: 20px 0;">
155
- <label class="btn btn-primary active rg-vertical-tab" tab="LOGIN_REQUIRE">
156
- <input type="radio" name="options" id="option1"> Facebook Connect
157
- </label>
158
- <label class="btn btn-primary rg-vertical-tab" tab="LOGIN_WITH_EMAIL">
159
- <input type="radio" name="options" id="option2"> Email Sign In
160
- </label>
161
- <label class="btn btn-primary rg-vertical-tab" tab="IMPORT_WITH_EMAIL">
162
- <input type="radio" name="options" id="option3"> Contact Importer
163
- </label>
164
- <label class="btn btn-primary rg-vertical-tab" tab="DEFAULT">
165
- <input type="radio" name="options" id="option4"> Invitation Page
166
- </label>
167
- <a href="#" class="help-tooltip"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/Help-icon.png" width="15px" style="margin-left:10px;"/><span><img class="callout" src="<?php echo plugin_dir_url( __FILE__ );?>assets/callout_black.gif" /><strong>ReadyGraph Plugin Settings</strong><br />You can directly edit the text in the orange box below.<br /></span></a>
168
- </div>
169
- <div class="rg-preview-widget" style=""></div>
170
- </div>
171
- <div style="width:50%; border-left: solid 1px #cccccc; text-align: left;padding-left: 25px;float:right">
172
- <div style="padding: 20px 0;">
173
- <p>Popup Templates:
174
- <select class="popup_template" name="popup_template" class="form-control">
175
- <option value="default-template">Default Template</option>
176
- <option value="red-template">Red Template</option>
177
- <option value="blue-template">Blue Template</option>
178
- <option value="black-template">Black Template</option>
179
- <option value="gray-template">Gray Template</option>
180
- <option value="green-template">Green Template</option>
181
- <option value="yellow-template">Yellow Template</option>
182
- <option value="custom-template">Custom Template</option>
183
- </select><a href="#" class="help-tooltip"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/Help-icon.png" width="15px" style="margin-left:10px;"/><span><img class="callout" src="<?php echo plugin_dir_url( __FILE__ );?>assets/callout_black.gif" /><strong>Templates</strong><br />For custom colors, select custom-template and change your colors in [plugin_name]/extension/readygraph/assets/css/custom-popup.css.<br />You can do a lot more with CSS.</span></a></p><br />
184
- <p>Signup Popup Delay:
185
- <select class="delay" name="delay" class="form-control">
186
- <option value="0">0 seconds</option>
187
- <option value="5000">5 seconds</option>
188
- <option value="10000">10 seconds</option>
189
- <option value="15000">15 seconds</option>
190
- <option value="20000">20 seconds</option>
191
- <option value="30000">30 seconds</option>
192
- <option value="60000">1 minute</option>
193
- <option value="120000">2 minutes</option>
194
- <option value="180000">3 minutes</option>
195
- <option value="240000">4 minutes</option>
196
- <option value="300000">5 minutes</option>
197
- <option value="600000">10 minutes</option>
198
- <option value="900000">15 minutes</option>
199
- <option value="1200000">20 minutes</option>
200
- </select><a href="#" class="help-tooltip"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/Help-icon.png" width="15px" style="margin-left:10px;"/><span><img class="callout" src="<?php echo plugin_dir_url( __FILE__ );?>assets/callout_black.gif" /><strong>ReadyGraph Popup Settings</strong><br />ReadyGraph's intelligent registration popup maximizes signups to your list. You can adjust it so that it displays to users after a preset time. Shorter times will yield more signups. <br /></span></a></p><br />
201
 
202
- <p>Enable Lower Right Notification:
203
- <select class="notification" name="notification" class="form-control">
204
- <option value="true">YES</option>
205
- <option value="false">NO</option>
206
- </select></p><br />
207
- <p>Pre-checked Invite Contact:
208
- <select class="selectAll" name="selectAll" class="form-control">
209
- <option value="true">YES</option>
210
- <option value="false">NO</option>
211
- </select></p><br />
212
- <p>Show Powered by Readygraph on popup:
213
- <select class="branding" name="branding" class="form-control">
214
- <option value="true">YES</option>
215
- <option value="false">NO</option>
216
- </select></p><br />
217
- <p>Include blog updates in daily/weekly email digest of Readygraph:
218
- <select class="blog_updates" name="blog_updates" class="form-control">
219
- <option value="true">YES</option>
220
- <option value="false">NO</option>
221
- </select></p><br />
222
- <p>Send Real Time Post Updates to your subscribers:
223
- <select class="real_time_post_update" name="real_time_post_update" class="form-control">
224
- <option value="true">YES</option>
225
- <option value="false">NO</option>
226
- </select></p><br />
227
-
228
-
229
- <p>If you have questions or concerns contact us anytime at <a href="mailto:info@readygraph.com" target="_blank">info@readygraph.com</a></p><br />
230
- </div>
231
- <div class="save-changes"><?php if(get_option('readygraph_tutorial') && get_option('readygraph_tutorial') == "true"){ ?><button type="submit" class="btn btn-large btn-warning save-next" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed&source=signup-popup" style="float: right;margin: 15px">Save Changes & Next</button> <?php } ?>
232
- <button type="submit" class="btn btn-large btn-warning save" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup" style="float: right;margin: 15px">Save Changes</button>
233
- <?php if(get_option('readygraph_tutorial') && get_option('readygraph_tutorial') == "true"){ ?><button type="submit" class="btn btn-large btn-warning save-previous" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=basic-settings&tutorial=true" style="float: right;margin: 15px">Previous</button> <?php } ?>
234
- </div>
235
- </div>
236
- </div>
237
- </div>
238
- </div>
239
  </form>
240
- <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
241
- <script type="text/javascript" charset="utf-8">
242
- var $ = jQuery;
243
- $(function () {
244
- var settings =
245
- {
246
- 'host': "www.readygraph.com"
247
- , 'clientId': "9838eb84c6da2fc44ab9"
248
- };
249
-
250
- var authHost = "https://" + settings.host;
251
- var resourceHost = "https://" + settings.host;
252
-
253
- // OAuth 2.0 Popup
254
- //
255
- var popupWindow=null;
256
- function openPopup(url)
257
- {
258
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
259
- else popupWindow = window.open(url,"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=515, height=330,top=" + (screen.height - 330)/2 + ",left=" + (screen.width - 515)/2);
260
- }
261
- function parent_disable() {
262
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
263
- }
264
-
265
- $("a.connect").click(function() {
266
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
267
- openPopup(url);
268
- $(document.body).bind('focus', parent_disable);
269
- $(document.body).bind('click', parent_disable);
270
- });
271
- $(".change-account").click(function() {
272
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
273
- var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
274
- openPopup(logout);
275
- $(document.body).bind('focus', parent_disable);
276
- $(document.body).bind('click', parent_disable);
277
- });
278
-
279
- // User Interface
280
- //
281
- $('.template').click(function() {
282
- $('#preview').attr('src', $(this).find('img').attr('src'));
283
- });
284
-
285
- // Manage OAuth 2.0 Redirect
286
- //
287
- var extractCode = function(hash) {
288
- var match = hash.match(/code=(\w+)/);
289
- return !!match && match[1];
290
- };
291
- var extractToken = function(hash) {
292
- var match = hash.match(/access_token=(\w+)/);
293
- return !!match && match[1];
294
- };
295
- var extractError = function(hash) {
296
- var match = hash.match(/error=(\w+)/);
297
- return !!match && match[1];
298
- };
299
-
300
- var code = extractCode(window.location.href);
301
- if (extractError(window.location.href) == 'access_denied') {
302
- window.close();
303
- }
304
- else if(code) {
305
- try { window.opener.setCode(code); }
306
- catch(ex) { }
307
- window.close();
308
- }
309
- else {
310
- $('.rgw-fb-login-button-iframe').hide();
311
- $('div.authenticate').show();
312
-
313
- if ($('[name="readygraph_access_token"]').val()) {
314
- $('.rgw-fb-login-button-iframe').show();
315
- $('div.authenticate').hide();
316
- $('div.authenticating').hide();
317
- $('div.authenticated').show();
318
-
319
- $('.email-address').text($('[name="readygraph_email"]').val());
320
-
321
- window.setup_readygraph($('[name="readygraph_application_id"]').val());
322
- $('.delay').val($('[name="readygraph_delay"]').val());
323
- $('.notification').val($('[name="readygraph_enable_notification"]').val());
324
- $('.selectAll').val($('[name="readygraph_auto_select_all"]').val());
325
- $('.branding').val($('[name="readygraph_enable_branding"]').val());
326
- $('.blog_updates').val($('[name="readygraph_send_blog_updates"]').val());
327
- $('.real_time_post_update').val($('[name="readygraph_send_real_time_post_updates"]').val());
328
- $('.popup_template').val($('[name="readygraph_popup_template"]').val());
329
-
330
- $('.result').text('...');
331
- if ($('[name="readygraph_access_token"]').val()) {
332
- $.ajax({
333
- url: resourceHost + '/api/v1/insight_info'
334
- , beforeSend: function (xhr) {
335
- xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
336
- xhr.setRequestHeader('Accept', "application/json");
337
- }
338
- , method: 'POST'
339
- , success: function (response) {
340
- if (response.data) {
341
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
342
- } else {
343
- $('.result').text('Insight');
344
- }
345
- }
346
- , error: function (response) {
347
- refresh_access_token();
348
- }
349
- });
350
- }
351
- }
352
- }
353
-
354
- // Manage OAuth 2.0 Results
355
-
356
- function refresh_access_token() {
357
- var refresh_token = $('[name="readygraph_refresh_token"]').val();
358
- if (refresh_token) {
359
- $('div.authenticate').hide();
360
- $('div.authenticating').show();
361
- $('div.authenticated').hide();
362
-
363
- $.ajax({
364
- url: resourceHost + '/oauth/access_token'
365
- , data: {
366
- grant_type: 'refresh_token',
367
- refresh_token: $('[name="readygraph_refresh_token"]').val(),
368
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
369
- client_id: settings.clientId
370
- }
371
- , method: 'POST'
372
- , success: function (response) {
373
- $('[name="readygraph_access_token"]').val(response.access_token);
374
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
375
- window.setAccessToken(response.access_token);
376
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
377
- }
378
- , error: function (response) {
379
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
380
- $('div.authenticate').show();
381
- $('div.authenticating').hide();
382
- $('div.authenticated').hide();
383
- }
384
- });
385
- }
386
- }
387
- window.setCode = function(code) {
388
- $('.rgw-fb-login-button-iframe').hide();
389
- $('div.authenticate').hide();
390
- $('div.authenticating').show();
391
- $('div.authenticated').hide();
392
-
393
- $.ajax({
394
- url: resourceHost + '/oauth/access_token'
395
- , data: {
396
- grant_type: 'authorization_code',
397
- code: code,
398
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
399
- client_id: settings.clientId
400
- }
401
- , method: 'POST'
402
- , success: function (response) {
403
- if (response) {
404
- $('[name="readygraph_access_token"]').val(response.access_token);
405
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
406
- window.setAccessToken(response.access_token);
407
- } else {
408
- $('div.authenticating').hide();
409
- $('div.authenticate').show();
410
- }
411
- }
412
- });
413
- }
414
- window.setAccessToken = function(token) {
415
- $('.rgw-fb-login-button-iframe').hide();
416
- $('div.authenticate').hide();
417
- $('div.authenticating').show();
418
- $('div.authenticated').hide();
419
-
420
- $.ajax({
421
- url: resourceHost + '/api/v1/account_info'
422
- , beforeSend: function (xhr) {
423
- xhr.setRequestHeader('Authorization', "Bearer " + token);
424
- xhr.setRequestHeader('Accept', "application/json");
425
- }
426
- , method: 'POST'
427
- , success: function (response) {
428
- if (response.data) {
429
- $('[name="readygraph_access_token"]').val(token);
430
- $('[name="readygraph_email"]').val(response.data.email);
431
- $('[name="readygraph_application_id"]').val(response.data.application_id);
432
- $('#myForm')[0].submit();
433
- } else {
434
- $('div.authenticating').hide();
435
- $('div.authenticate').show();
436
- $('.rgw-fb-login-button-iframe').hide();
437
- }
438
- }
439
- });
440
- }
441
- });
442
- </script>
443
- <script>
444
- window.setup = false;
445
- window.refresh_readygraph = function() {};
446
- window.setup_readygraph = function(app_id) {
447
- if (window.setup) {
448
- window.refresh_readygraph();
449
- return;
450
- }
451
- window.setup = true;
452
- readygraph.setup({
453
- applicationId: app_id,
454
- isPreview: true,
455
- enableLoginWall: false,
456
- enableDistraction: false,
457
- enableAutoLogin: false,
458
- enableSidebar: false,
459
- enableNotification: false,
460
- enableInvite: false,
461
- enableOpenGraph: false,
462
- enableRgSeo: false
463
- });
464
- readygraph.ready(function() {
465
- readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
466
- var $ = readygraph.framework.jQuery;
467
- $.cookie('RGAuth', null);
468
- readygraph.framework.facebook.logout(function() {
469
- readygraph.framework.require(['invite'], function() {
470
- var VIEW_TYPE = {
471
- LOADING: 0,
472
- LOGIN_REQUIRE: 1,
473
- PERMISSION_REQUIRE: 2,
474
- DEFAULT: 3,
475
- LOGIN_WITH_EMAIL: 4,
476
- SIGNUP_WITH_EMAIL: 5,
477
- IMPORT_WITH_EMAIL: 6,
478
- FINISH: 10
479
- };
480
-
481
- var auth = new readygraph.framework.ui.AuthModel({
482
- dialog: true,
483
- 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
484
- });
485
- $('.rg-preview-widget').html('');
486
- $('.rg-preview-widget').append(auth.lightbox.view.$el);
487
- $('.rgw-content').attr('style', 'position: relative !important;');
488
-
489
- var view = VIEW_TYPE.LOGIN_REQUIRE;
490
- auth.on('switch', function() {
491
- if (auth.view.currentView != view) { auth.view.switchView(view); }
492
- else auth.view.render();
493
- if (view == VIEW_TYPE.DEFAULT) {
494
- auth.view.$el.find('.rgw-invite-view').showAndAnimate();
495
- auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
496
- auth.view.$el.commitTransition();
497
- }
498
- });
499
- auth.view.switchView(view);
500
-
501
- $(window).scroll(function() {
502
- $(window).trigger('rgw-invalidate');
503
- });
504
- $('.rg-preview-widget, .content-warp').scroll(function() {
505
- $(window).trigger('rgw-invalidate');
506
- });
507
- $(window).trigger('rgw-invalidate');
508
-
509
- $('.rg-vertical-tab').click(function() {
510
- saveContent(auth, $('.rg-preview-widget-container'), true);
511
-
512
- $('.rg-vertical-tab').removeClass('active');
513
- $(this).addClass('active');
514
- view = VIEW_TYPE[$(this).attr('tab')];
515
- if (auth.view.currentView != view) { auth.view.switchView(view); }
516
-
517
- $('.rg-preview-widget, .content-warp').scrollTop(10000);
518
- });
519
-
520
- enableContentEditable(auth, $('.rg-preview-widget-container'));
521
- restoreContent(auth, $('.rg-preview-widget-container'));
522
-
523
- $('.save').click(function() {
524
- $('.save').css('opacity', 0.4);
525
- saveContent(auth, $('.rg-preview-widget-container'), false);
526
- });
527
-
528
- window.refresh_readygraph = function() {
529
- restoreContent(auth, $('.rg-preview-widget-container'));
530
- }
531
- });
532
- });
533
- });
534
- });
535
- }
536
- function enableContentEditable(model, container) {
537
- model.view.$el.find('[rgw-data-key]').each(function() {
538
- var element = $(this);
539
- if (element.attr('rgw-data-editable') == 'false') return;
540
-
541
- if (element.attr('editing') != null) return;
542
- container.find('.special-button-container button').attr('disabled', 'disabled');
543
- element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
544
- element.attr('editing', '1');
545
- element.css({
546
- 'border': '2px dashed orange',
547
- 'position': 'relative',
548
- 'top': '-2px',
549
- 'margin-bottom': '-4px',
550
- 'background-color': '#FAFAC5'
551
- });
552
- element.attr('contenteditable', true);
553
- element.bind('paste', function(e) {
554
- e.preventDefault();
555
- });
556
- element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
557
- });
558
- }
559
- function saveContent(model, container, fake) {
560
- var settings = {};
561
- model.view.$el.find('[rgw-data-key]').each(function() {
562
- var element = $(this);
563
- if (element.attr('rgw-data-editable') == 'false') return;
564
- settings[element.attr('rgw-data-key')] = element.text();
565
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
566
- });
567
- if (!fake) {
568
- $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
569
- $('#myForm')[0].submit();
570
- }
571
- }
572
- function restoreContent(model, container) {
573
- eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
574
- var settings = window._TEMP;
575
- if (settings) {
576
- model.view.$el.find('[rgw-data-key]').each(function() {
577
- var element = $(this);
578
- if (element.attr('rgw-data-editable') == 'false') return;
579
- element.text(settings[element.attr('rgw-data-key')]);
580
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
581
- });
582
- }
583
- }
584
- </script>
585
- <style>
586
- /* FOR INLINE WIDGET */
587
- .rgw-overlay {
588
- display: none !important;
589
- }
590
- .rgw-content-frame {
591
- left: 0 !important;
592
- top: 0 !important;
593
- position: relative !important;
594
- margin: 0 auto !important;
595
- border: solid 1px #cccccc;
596
- }
597
- .rgw-preview-warning {
598
- display: none !important;
599
- }
600
- .rgw-content {
601
- position: relative !important;
602
- }
603
- </style>
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
  /**
4
  * Represents the view for the administration dashboard.
5
  *
13
  * @copyright 2014 Your Name or Company Name
14
  */
15
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
+ include("header.php");
18
+
19
+ if(isset($_GET["readygraph_upgrade_notice"]) && $_GET["readygraph_upgrade_notice"] == "dismiss") {update_option('readygraph_upgrade_notice', 'false');}
20
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
 
21
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
22
  echo '<script>window.location.replace("'.$current_url[0].'");</script>';
23
  }
24
  else {
25
+ if(isset($_GET["source"]) && $_GET["source"] == "basic-settings"){
26
 
27
  }
28
  else{
30
  if (isset($_POST["readygraph_refresh_token"])) update_option('readygraph_refresh_token', $_POST["readygraph_refresh_token"]);
31
  if (isset($_POST["readygraph_email"])) update_option('readygraph_email', $_POST["readygraph_email"]);
32
  if (isset($_POST["readygraph_application_id"])) update_option('readygraph_application_id', $_POST["readygraph_application_id"]);
33
+
34
+ if (isset($_POST["sitedesceditor"])) update_option('readygraph_site_description', $_POST["sitedesceditor"]);
35
+ if (isset($_POST["site_profile_name"])) update_option('readygraph_site_name', $_POST["site_profile_name"]);
36
+ if (isset($_POST["site_profile_url"])) update_option('readygraph_site_url', $_POST["site_profile_url"]);
37
+ if (isset($_POST["site_category"])) update_option('readygraph_site_category', $_POST["site_category"]);
38
+ if (isset($_POST["site_language"])) {update_option('readygraph_site_language', $_POST["site_language"]);s2_siteprofile_sync();}
39
+
40
  if (isset($_POST["readygraph_settings"])) update_option('readygraph_settings', $_POST["readygraph_settings"]);
41
  if (isset($_POST["readygraph_delay"])) {
42
  update_option('readygraph_delay', $_POST["delay"]);
62
  </style>
63
  <?php } ?>
64
 
 
 
65
  <form method="post" id="myForm">
66
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
67
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
75
  <input type="hidden" name="readygraph_send_blog_updates" value="<?php echo get_option('readygraph_send_blog_updates', 'true') ?>">
76
  <input type="hidden" name="readygraph_send_real_time_post_updates" value="<?php echo get_option('readygraph_send_real_time_post_updates', 'false') ?>">
77
  <input type="hidden" name="readygraph_popup_template" value="<?php echo get_option('readygraph_popup_template', 'default-template') ?>">
78
+ <div><div><a href="#">Grow Users</a> > Signup Popup</div>
79
+ <?php if(get_option('readygraph_upgrade_notice') && get_option('readygraph_upgrade_notice') == "true") { ?><div class="upgrade-notice"><div class="aa_close"><a href="<?php echo $_SERVER['REQUEST_URI']; ?>&readygraph_upgrade_notice=dismiss"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/dialog_close.png"></a></div>
80
+ <div class="upgrade-notice-text">Want to grow your users even faster? Try <a href="https://readygraph.com/accounts/payment/?email=<?php echo get_option('readygraph_email', ''); ?>" target="_blank">ReadyGraph Premium</a> for free.</div>
81
+ </div>
82
+ <?php } ?>
83
+ <h3 style="font-weight: normal; text-align: center;">Increase signups with the Intelligent Signup Popup</h3>
84
+ <h4 style="font-weight: normal; text-align: center;">Users instantly added to your list - One Click Signup - Automatically targets engaged users</h4>
85
+ <div style="width: 90%; margin: 0 auto;">
86
+ <div class="rg-vertical-tab-body-container" style="width: 50%; text-align: center;float: left">
87
+ <div class="btn-group" data-toggle="buttons" style="padding: 20px 0;">
88
+ <label class="btn btn-primary active rg-vertical-tab" tab="LOGIN_REQUIRE">
89
+ <input type="radio" name="options" id="option1"> Facebook Connect
90
+ </label>
91
+ <label class="btn btn-primary rg-vertical-tab" tab="LOGIN_WITH_EMAIL">
92
+ <input type="radio" name="options" id="option2"> Email Sign In
93
+ </label>
94
+ <label class="btn btn-primary rg-vertical-tab" tab="IMPORT_WITH_EMAIL">
95
+ <input type="radio" name="options" id="option3"> Contact Importer
96
+ </label>
97
+ <label class="btn btn-primary rg-vertical-tab" tab="DEFAULT">
98
+ <input type="radio" name="options" id="option4"> Invitation Page
99
+ </label>
100
+ <a href="#" class="help-tooltip"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/Help-icon.png" width="15px" style="margin-left:10px;"/><span><img class="callout" src="<?php echo plugin_dir_url( __FILE__ );?>assets/callout_black.gif" /><strong>ReadyGraph Plugin Settings</strong><br />You can directly edit the text in the orange box below.<br /></span></a>
101
+ </div>
102
+ <div class="rg-preview-widget" style=""></div>
103
+ </div>
104
+ <div style="width:50%; border-left: solid 1px #cccccc; text-align: left;padding-left: 25px;float:right">
105
+ <div style="padding: 20px 0;">
106
+ <p>Popup Templates:
107
+ <select class="popup_template" name="popup_template" class="form-control">
108
+ <option value="default-template">Default Template</option>
109
+ <option value="red-template">Red Template</option>
110
+ <option value="blue-template">Blue Template</option>
111
+ <option value="black-template">Black Template</option>
112
+ <option value="gray-template">Gray Template</option>
113
+ <option value="green-template">Green Template</option>
114
+ <option value="yellow-template">Yellow Template</option>
115
+ <option value="custom-template">Custom Template</option>
116
+ </select><a href="#" class="help-tooltip"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/Help-icon.png" width="15px" style="margin-left:10px;"/><span><img class="callout" src="<?php echo plugin_dir_url( __FILE__ );?>assets/callout_black.gif" /><strong>Templates</strong><br />For custom colors, select custom-template and change your colors in [plugin_name]/extension/readygraph/assets/css/custom-popup.css.<br />You can do a lot more with CSS.</span></a></p><br />
117
+ <p>Signup Popup Delay:
118
+ <select class="delay" name="delay" class="form-control">
119
+ <option value="0">0 seconds</option>
120
+ <option value="5000">5 seconds</option>
121
+ <option value="10000">10 seconds</option>
122
+ <option value="15000">15 seconds</option>
123
+ <option value="20000">20 seconds</option>
124
+ <option value="30000">30 seconds</option>
125
+ <option value="60000">1 minute</option>
126
+ <option value="120000">2 minutes</option>
127
+ <option value="180000">3 minutes</option>
128
+ <option value="240000">4 minutes</option>
129
+ <option value="300000">5 minutes</option>
130
+ <option value="600000">10 minutes</option>
131
+ <option value="900000">15 minutes</option>
132
+ <option value="1200000">20 minutes</option>
133
+ </select><a href="#" class="help-tooltip"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/Help-icon.png" width="15px" style="margin-left:10px;"/><span><img class="callout" src="<?php echo plugin_dir_url( __FILE__ );?>assets/callout_black.gif" /><strong>ReadyGraph Popup Settings</strong><br />ReadyGraph's intelligent registration popup maximizes signups to your list. You can adjust it so that it displays to users after a preset time. Shorter times will yield more signups. <br /></span></a></p><br />
134
+
135
+ <p>Enable Lower Right Notification:
136
+ <select class="notification" name="notification" class="form-control">
137
+ <option value="true">YES</option>
138
+ <option value="false">NO</option>
139
+ </select></p><br />
140
+ <p>Pre-checked Invite Contact:
141
+ <select class="selectAll" name="selectAll" class="form-control">
142
+ <option value="true">YES</option>
143
+ <option value="false">NO</option>
144
+ </select></p><br />
145
+ <p>Show Powered by Readygraph on popup:
146
+ <select class="branding" name="branding" class="form-control">
147
+ <option value="true">YES</option>
148
+ <option value="false">NO</option>
149
+ </select></p><br />
150
+ <p>Include blog updates in daily/weekly email digest of Readygraph:
151
+ <select class="blog_updates" name="blog_updates" class="form-control">
152
+ <option value="true">YES</option>
153
+ <option value="false">NO</option>
154
+ </select></p><br />
155
+ <p>Send Real Time Post Updates to your subscribers:
156
+ <select class="real_time_post_update" name="real_time_post_update" class="form-control">
157
+ <option value="true">YES</option>
158
+ <option value="false">NO</option>
159
+ </select></p><br />
160
 
161
 
162
+ <p>If you have questions or concerns contact us anytime at <a href="mailto:info@readygraph.com" target="_blank">info@readygraph.com</a></p><br />
 
 
 
 
 
 
 
 
 
 
 
 
163
  </div>
164
+ <div class="save-changes"><?php if(get_option('readygraph_tutorial') && get_option('readygraph_tutorial') == "true"){ ?><button type="submit" class="btn btn-large btn-warning save-next" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed&source=signup-popup" style="float: right;margin: 15px">Save Changes & Next</button> <?php } ?>
165
+ <button type="submit" class="btn btn-large btn-warning save" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup" style="float: right;margin: 15px">Save Changes</button>
166
+ <?php if(get_option('readygraph_tutorial') && get_option('readygraph_tutorial') == "true"){ ?><button type="submit" class="btn btn-large btn-warning save-previous" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile" style="float: right;margin: 15px">Previous</button> <?php } ?>
 
 
 
 
167
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  </div>
170
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  </form>
173
+ <?php include("footer.php"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
extension/readygraph/site-profile.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Represents the view for the administration dashboard.
4
  *
@@ -12,22 +13,8 @@
12
  * @copyright 2014 Your Name or Company Name
13
  */
14
 
15
- function s2_disconnectReadyGraph(){
16
- $app_id = get_option('readygraph_application_id');
17
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=disconnect_readygraph&app_id=$app_id" );
18
- s2_delete_rg_options();
19
- }
20
- function s2_deleteReadyGraph(){
21
- $app_id = get_option('readygraph_application_id');
22
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=uninstall_readygraph&app_id=$app_id" );
23
- s2_delete_rg_options();
24
- $dir = plugin_dir_path( __FILE__ );
25
- s2_rrmdir($dir);
26
- }
27
 
28
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "changeaccount")s2_disconnectReadyGraph();
29
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "deleteaccount")s2_deleteReadyGraph();
30
- global $main_plugin_title;
31
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
32
  //redirect to main page
33
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
@@ -39,93 +26,298 @@ s2_rrmdir($dir);
39
  if (isset($_POST["readygraph_email"])) update_option('readygraph_email', $_POST["readygraph_email"]);
40
  if (isset($_POST["readygraph_application_id"])) update_option('readygraph_application_id', $_POST["readygraph_application_id"]);
41
  if (isset($_POST["sitedesceditor"])) update_option('readygraph_site_description', $_POST["sitedesceditor"]);
42
- if (isset($_POST["site_name"])) update_option('readygraph_site_name', $_POST["site_name"]);
43
- if (isset($_POST["site_url"])) update_option('readygraph_site_url', $_POST["site_url"]);
44
-
45
-
 
 
46
  }
 
 
 
47
  ?>
48
 
49
- <link rel="stylesheet" type="text/css" href="<?php echo plugins_url( 'assets/css/admin.css', __FILE__ ) ?>">
50
- <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/admin.js', __FILE__ ) ?>"></script>
 
 
 
 
 
 
 
 
 
51
  <form method="post" id="myForm">
52
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
53
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
54
  <input type="hidden" name="readygraph_email" value="<?php echo get_option('readygraph_email', '') ?>">
55
  <input type="hidden" name="readygraph_application_id" value="<?php echo get_option('readygraph_application_id', '') ?>">
56
-
57
-
58
- <style>a.help-tooltip {outline:none; }a.help-tooltip strong {line-height:30px;}a.help-tooltip:hover {text-decoration:none;} a.help-tooltip span { z-index:10;display:none; padding:14px 20px; margin-top:40px; margin-left:-150px; width:300px; line-height:16px;}a.help-tooltip:hover span{ display:inline; position:absolute; border:2px solid #FFF; background:#fff; text-align: justify; z-index:1000000000;}.callout {z-index:1000000000;position:absolute;border:0;top:-14px;left:120px;} /*CSS3 extras*/a.help-tooltip span{ border-radius:2px; -moz-border-radius: 2px; -webkit-border-radius: 2px; -moz-box-shadow: 0px 0px 8px 4px #666; -webkit-box-shadow: 0px 0px 8px 4px #666; box-shadow: 0px 0px 8px 4px #666;}</style>
59
- <div class="authenticated" style="display: none;">
60
- <div style="background-color: #2961cb; min-width: 90%; height: 50px;margin-right: 1%;">
61
- <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/white-logo.png" style="width: 138px; height: 30px; margin: 10px 0 0 15px; float: left;">
62
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
63
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
64
- <span class="email-address" style="text-shadow: none;"></span> <span class="caret"></span>
65
- </button>
66
- <ul class="dropdown-menu">
67
- <li><a class="change-account" href="#">Change Account</a></li>
68
- <li><a class="disconnect" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("changeaccount");?>">Disconnect</a></li>
69
- <li><a class="delete" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("deleteaccount");?>">Delete ReadyGraph</a></li>
70
- </ul>
71
- </div>
72
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
73
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
74
- <span class="result" style="text-shadow: none;">...</span> <span class="caret"></span>
75
- </button>
76
- <ul class="dropdown-menu">
77
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Insights</a></li>
78
- </ul>
79
- </div>
80
- <div style="clear: both;"></div>
81
- </div>
82
- <!-- write menu code-->
83
- <div class="readygraph-menu">
84
- <div class="menu-tabs"><h4>Grow Users</h4>
85
- <ul>
86
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
87
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
88
- <li><a href="#"></a></li>
89
- </ul>
90
- </div>
91
- <div class="menu-tabs"><h4>Email Users</h4>
92
- <ul>
93
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
94
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
95
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
96
- </ul>
97
- </div>
98
- <div class="menu-tabs"><h4>Engage Users</h4>
99
- <ul>
100
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed">Social Feed</a></li>
101
- <li><a href="#">Social Followers</a></li>
102
- <li><a href="#">Feedback Survey</a></li>
103
- </ul>
104
- </div>
105
- <div class="menu-tabs"><h4>Basic Settings</h4>
106
- <ul>
107
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
108
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=feature-settings">Feature Settings</a></li>
109
-
110
- </ul>
111
  </div>
112
- <div class="menu-tabs" style="float:right"><h4>&nbsp;</h4>
113
- <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
114
- <p>
115
- <a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=faq" style="color: #b1c1ca" >FAQ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/10.png" /></a></p>
116
-
117
- </ul>
118
- </div>
119
- </div>
120
- <div><div><a href="#">Basic Settings</a> > Site Profile</div>
121
  <h3 style="font-weight: normal; text-align: center;">Be sure your site profile is accurate!</h3>
122
  <h4 style="font-weight: normal; text-align: center;">This content is used in your site's features and emails</h4>
123
  <div style="margin: 0 5%;">
124
- <div style="display: block"><label for="site_profile_image_upload">Site Icon: </label> <input type="file" name="site_profile_image_upload" id="site_profile_image_upload" multiple="false" style="display: inline" /></div>
125
- <div style="display: block"><label for="site_profile_name">Site Name</label><input type="text" name="site_profile_name" id="site_profile_name" value="<?php echo get_option('readygraph_site_name');?>" style="display: inline" /></div>
126
- <div style="display: block"><label for="site_profile_url">Site URL</label><input type="text" name="site_profile_url" id="site_profile_url" value="<?php echo get_option('readygraph_site_url');?>" style="display: inline" /></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  <div style="display: block; width:50%">
128
- <label for="sitedesceditor">Site Description:</label><?php /**
129
 
130
  /**
131
  * Basic syntax
@@ -142,373 +334,24 @@ wp_editor( $content, $editor_id, $settings );
142
  ?>
143
  </div>
144
  </div>
145
- <div class="save-changes"><button type="submit" class="btn btn-large btn-warning save-next" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=customize-email" style="float: right;margin: 15px">Save Changes & Next</button>
146
- <button type="submit" class="btn btn-large btn-warning save" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile" style="float: right;margin: 15px">Save Changes</button>
147
- <button type="submit" class="btn btn-large btn-warning save-previous" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed" style="float: right;margin: 15px">Previous</button>
 
148
  </div>
149
  </div>
150
  </div>
151
  </form>
152
- <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
153
- <script type="text/javascript" charset="utf-8">
154
- var $ = jQuery;
155
- $(function () {
156
- var settings =
157
- {
158
- 'host': "www.readygraph.com"
159
- , 'clientId': "9838eb84c6da2fc44ab9"
160
- };
161
 
162
- var authHost = "https://" + settings.host;
163
- var resourceHost = "https://" + settings.host;
164
-
165
- // OAuth 2.0 Popup
166
- //
167
- var popupWindow=null;
168
- function openPopup(url)
169
- {
170
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
171
- else popupWindow = window.open(url,"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=515, height=330,top=" + (screen.height - 330)/2 + ",left=" + (screen.width - 515)/2);
172
- }
173
- function parent_disable() {
174
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
175
- }
176
-
177
- $("a.connect").click(function() {
178
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
179
- openPopup(url);
180
- $(document.body).bind('focus', parent_disable);
181
- $(document.body).bind('click', parent_disable);
182
- });
183
- $(".change-account").click(function() {
184
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
185
- var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
186
- openPopup(logout);
187
- $(document.body).bind('focus', parent_disable);
188
- $(document.body).bind('click', parent_disable);
189
- });
190
-
191
- // User Interface
192
- //
193
- $('.template').click(function() {
194
- $('#preview').attr('src', $(this).find('img').attr('src'));
195
- });
196
-
197
- // Manage OAuth 2.0 Redirect
198
- //
199
- var extractCode = function(hash) {
200
- var match = hash.match(/code=(\w+)/);
201
- return !!match && match[1];
202
- };
203
- var extractToken = function(hash) {
204
- var match = hash.match(/access_token=(\w+)/);
205
- return !!match && match[1];
206
- };
207
- var extractError = function(hash) {
208
- var match = hash.match(/error=(\w+)/);
209
- return !!match && match[1];
210
- };
211
-
212
- var code = extractCode(window.location.href);
213
- if (extractError(window.location.href) == 'access_denied') {
214
- window.close();
215
- }
216
- else if(code) {
217
- try { window.opener.setCode(code); }
218
- catch(ex) { }
219
- window.close();
220
- }
221
- else {
222
- $('.rgw-fb-login-button-iframe').hide();
223
- $('div.authenticate').show();
224
-
225
- if ($('[name="readygraph_access_token"]').val()) {
226
- $('.rgw-fb-login-button-iframe').show();
227
- $('div.authenticate').hide();
228
- $('div.authenticating').hide();
229
- $('div.authenticated').show();
230
-
231
- $('.email-address').text($('[name="readygraph_email"]').val());
232
-
233
- window.setup_readygraph($('[name="readygraph_application_id"]').val());
234
-
235
- //$('[name="readygraph_ad_format"][value="' + $('[name="_readygraph_ad_format"]').val() + '"]').parent().click();
236
- //$('[name="readygraph_ad_timing"][value="' + $('[name="_readygraph_ad_timing"]').val() + '"]').parent().click();
237
-
238
- //$('[name="readygraph_ad_delay"]').val($('[name="_readygraph_ad_delay"]').val());
239
- //$('[name="readygraph_ad_scroll"]').val($('[name="_readygraph_ad_scroll"]').val());
240
-
241
- $('.result').text('...');
242
- if ($('[name="readygraph_access_token"]').val()) {
243
- $.ajax({
244
- url: resourceHost + '/api/v1/insight_info'
245
- , beforeSend: function (xhr) {
246
- xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
247
- xhr.setRequestHeader('Accept', "application/json");
248
- }
249
- , method: 'POST'
250
- , success: function (response) {
251
- if (response.data) {
252
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
253
- } else {
254
- $('.result').text('Insight');
255
- }
256
- }
257
- , error: function (response) {
258
- refresh_access_token();
259
- }
260
- });
261
- }
262
- }
263
- }
264
-
265
- // Manage OAuth 2.0 Results
266
- //
267
- function refresh_access_token() {
268
- var refresh_token = $('[name="readygraph_refresh_token"]').val();
269
- if (refresh_token) {
270
- $('div.authenticate').hide();
271
- $('div.authenticating').show();
272
- $('div.authenticated').hide();
273
-
274
- $.ajax({
275
- url: resourceHost + '/oauth/access_token'
276
- , data: {
277
- grant_type: 'refresh_token',
278
- refresh_token: $('[name="readygraph_refresh_token"]').val(),
279
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
280
- client_id: settings.clientId
281
- }
282
- , method: 'POST'
283
- , success: function (response) {
284
- $('[name="readygraph_access_token"]').val(response.access_token);
285
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
286
- window.setAccessToken(response.access_token);
287
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
288
- }
289
- , error: function (response) {
290
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
291
- $('div.authenticate').show();
292
- $('div.authenticating').hide();
293
- $('div.authenticated').hide();
294
- }
295
- });
296
- }
297
- }
298
- window.setCode = function(code) {
299
- $('.rgw-fb-login-button-iframe').hide();
300
- $('div.authenticate').hide();
301
- $('div.authenticating').show();
302
- $('div.authenticated').hide();
303
-
304
- $.ajax({
305
- url: resourceHost + '/oauth/access_token'
306
- , data: {
307
- grant_type: 'authorization_code',
308
- code: code,
309
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
310
- client_id: settings.clientId
311
- }
312
- , method: 'POST'
313
- , success: function (response) {
314
- if (response) {
315
- $('[name="readygraph_access_token"]').val(response.access_token);
316
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
317
- window.setAccessToken(response.access_token);
318
- } else {
319
- $('div.authenticating').hide();
320
- $('div.authenticate').show();
321
- }
322
- }
323
- });
324
- }
325
- window.setAccessToken = function(token) {
326
- $('.rgw-fb-login-button-iframe').hide();
327
- $('div.authenticate').hide();
328
- $('div.authenticating').show();
329
- $('div.authenticated').hide();
330
-
331
- $.ajax({
332
- url: resourceHost + '/api/v1/account_info'
333
- , beforeSend: function (xhr) {
334
- xhr.setRequestHeader('Authorization', "Bearer " + token);
335
- xhr.setRequestHeader('Accept', "application/json");
336
- }
337
- , method: 'POST'
338
- , success: function (response) {
339
- if (response.data) {
340
- $('[name="readygraph_access_token"]').val(token);
341
- $('[name="readygraph_email"]').val(response.data.email);
342
- $('[name="readygraph_application_id"]').val(response.data.application_id);
343
- $('#myForm')[0].submit();
344
- } else {
345
- $('div.authenticating').hide();
346
- $('div.authenticate').show();
347
- $('.rgw-fb-login-button-iframe').hide();
348
- }
349
- }
350
- });
351
- }
352
- });
353
- </script>
354
- <script>
355
- window.setup = false;
356
- window.refresh_readygraph = function() {};
357
- window.setup_readygraph = function(app_id) {
358
- if (window.setup) {
359
- window.refresh_readygraph();
360
- return;
361
- }
362
- window.setup = true;
363
- readygraph.setup({
364
- applicationId: app_id,
365
- isPreview: true,
366
- enableLoginWall: false,
367
- enableDistraction: false,
368
- enableAutoLogin: false,
369
- enableSidebar: false,
370
- enableNotification: false,
371
- enableInvite: false,
372
- enableOpenGraph: false,
373
- enableRgSeo: false
374
- });
375
- readygraph.ready(function() {
376
- readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
377
- var $ = readygraph.framework.jQuery;
378
- $.cookie('RGAuth', null);
379
- readygraph.framework.facebook.logout(function() {
380
- readygraph.framework.require(['invite'], function() {
381
- var VIEW_TYPE = {
382
- LOADING: 0,
383
- LOGIN_REQUIRE: 1,
384
- PERMISSION_REQUIRE: 2,
385
- DEFAULT: 3,
386
- LOGIN_WITH_EMAIL: 4,
387
- SIGNUP_WITH_EMAIL: 5,
388
- IMPORT_WITH_EMAIL: 6,
389
- FINISH: 10
390
- };
391
-
392
- var auth = new readygraph.framework.ui.AuthModel({
393
- dialog: true,
394
- 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
395
- });
396
- $('.rg-preview-widget').html('');
397
- $('.rg-preview-widget').append(auth.lightbox.view.$el);
398
- $('.rgw-content').attr('style', 'position: relative !important;');
399
-
400
- var view = VIEW_TYPE.LOGIN_REQUIRE;
401
- auth.on('switch', function() {
402
- if (auth.view.currentView != view) { auth.view.switchView(view); }
403
- else auth.view.render();
404
- if (view == VIEW_TYPE.DEFAULT) {
405
- auth.view.$el.find('.rgw-invite-view').showAndAnimate();
406
- auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
407
- auth.view.$el.commitTransition();
408
- }
409
- });
410
- auth.view.switchView(view);
411
-
412
- $(window).scroll(function() {
413
- $(window).trigger('rgw-invalidate');
414
- });
415
- $('.rg-preview-widget, .content-warp').scroll(function() {
416
- $(window).trigger('rgw-invalidate');
417
- });
418
- $(window).trigger('rgw-invalidate');
419
-
420
- $('.rg-vertical-tab').click(function() {
421
- saveContent(auth, $('.rg-preview-widget-container'), true);
422
-
423
- $('.rg-vertical-tab').removeClass('active');
424
- $(this).addClass('active');
425
- view = VIEW_TYPE[$(this).attr('tab')];
426
- if (auth.view.currentView != view) { auth.view.switchView(view); }
427
-
428
- $('.rg-preview-widget, .content-warp').scrollTop(10000);
429
- });
430
-
431
- enableContentEditable(auth, $('.rg-preview-widget-container'));
432
- restoreContent(auth, $('.rg-preview-widget-container'));
433
-
434
- $('.save').click(function() {
435
- $('.save').css('opacity', 0.4);
436
- saveContent(auth, $('.rg-preview-widget-container'), false);
437
- });
438
-
439
- window.refresh_readygraph = function() {
440
- restoreContent(auth, $('.rg-preview-widget-container'));
441
- }
442
- });
443
- });
444
- });
445
- });
446
- }
447
- function enableContentEditable(model, container) {
448
- model.view.$el.find('[rgw-data-key]').each(function() {
449
- var element = $(this);
450
- if (element.attr('rgw-data-editable') == 'false') return;
451
-
452
- if (element.attr('editing') != null) return;
453
- container.find('.special-button-container button').attr('disabled', 'disabled');
454
- element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
455
- element.attr('editing', '1');
456
- element.css({
457
- 'border': '2px dashed orange',
458
- 'position': 'relative',
459
- 'top': '-2px',
460
- 'margin-bottom': '-4px',
461
- 'background-color': '#FAFAC5'
462
- });
463
- element.attr('contenteditable', true);
464
- element.bind('paste', function(e) {
465
- e.preventDefault();
466
- });
467
- element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
468
- });
469
- }
470
- function saveContent(model, container, fake) {
471
- var settings = {};
472
- model.view.$el.find('[rgw-data-key]').each(function() {
473
- var element = $(this);
474
- if (element.attr('rgw-data-editable') == 'false') return;
475
- settings[element.attr('rgw-data-key')] = element.text();
476
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
477
- });
478
- if (!fake) {
479
- $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
480
- $('#myForm')[0].submit();
481
- }
482
  }
483
- function restoreContent(model, container) {
484
- eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
485
- var settings = window._TEMP;
486
- if (settings) {
487
- model.view.$el.find('[rgw-data-key]').each(function() {
488
- var element = $(this);
489
- if (element.attr('rgw-data-editable') == 'false') return;
490
- element.text(settings[element.attr('rgw-data-key')]);
491
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
492
- });
493
- }
494
  }
495
  </script>
496
- <style>
497
- /* FOR INLINE WIDGET */
498
- .rgw-overlay {
499
- display: none !important;
500
- }
501
- .rgw-content-frame {
502
- left: 0 !important;
503
- top: 0 !important;
504
- position: relative !important;
505
- margin: 0 auto !important;
506
- border: solid 1px #cccccc;
507
- }
508
- .rgw-preview-warning {
509
- display: none !important;
510
- }
511
- .rgw-content {
512
- position: relative !important;
513
- }
514
- </style>
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
  /**
4
  * Represents the view for the administration dashboard.
5
  *
13
  * @copyright 2014 Your Name or Company Name
14
  */
15
 
16
+ include("header.php");
 
 
 
 
 
 
 
 
 
 
 
17
 
 
 
 
18
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
19
  //redirect to main page
20
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
26
  if (isset($_POST["readygraph_email"])) update_option('readygraph_email', $_POST["readygraph_email"]);
27
  if (isset($_POST["readygraph_application_id"])) update_option('readygraph_application_id', $_POST["readygraph_application_id"]);
28
  if (isset($_POST["sitedesceditor"])) update_option('readygraph_site_description', $_POST["sitedesceditor"]);
29
+ if (isset($_POST["site_profile_name"])) update_option('readygraph_site_name', $_POST["site_profile_name"]);
30
+ if (isset($_POST["site_profile_url"])) update_option('readygraph_site_url', $_POST["site_profile_url"]);
31
+ if (isset($_POST["site_category"])) update_option('readygraph_site_category', $_POST["site_category"]);
32
+ if (isset($_POST["site_language"])) update_option('readygraph_site_language', $_POST["site_language"]);
33
+ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
34
+ s2_siteprofile_sync();
35
  }
36
+ }
37
+ if(isset($_GET["readygraph_plan"]) && $_GET["readygraph_plan"] != ""){update_option('readygraph_plan',$_GET["readygraph_plan"]);}
38
+
39
  ?>
40
 
41
+
42
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
43
+ <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/jquery.dependent-selects.js', __FILE__ ) ?>"></script>
44
+ <script type="text/javascript" charset="utf-8">
45
+ $(function(){
46
+ jQuery('.dependent-demo2').dependentSelects({
47
+ separator: '||',
48
+ placeholderOption: '-- Please Select --'
49
+ });
50
+ })
51
+ </script>
52
  <form method="post" id="myForm">
53
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
54
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
55
  <input type="hidden" name="readygraph_email" value="<?php echo get_option('readygraph_email', '') ?>">
56
  <input type="hidden" name="readygraph_application_id" value="<?php echo get_option('readygraph_application_id', '') ?>">
57
+ <input type="hidden" name="readygraph_site_category" value="<?php echo get_option('readygraph_site_category', '') ?>">
58
+ <input type="hidden" name="readygraph_site_language" value="<?php echo get_option('readygraph_site_language', '') ?>">
59
+ <div><div><a href="#">Basic Settings</a> > Site Profile</div>
60
+ <?php if(get_option('readygraph_upgrade_notice') && get_option('readygraph_upgrade_notice') == "true") { ?><div class="upgrade-notice"><div class="aa_close"><a href="<?php echo $_SERVER['REQUEST_URI']; ?>&readygraph_upgrade_notice=dismiss"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/dialog_close.png"></a></div>
61
+ <div class="upgrade-notice-text">Want to grow your users even faster? Try <a href="https://readygraph.com/accounts/payment/?email=<?php echo get_option('readygraph_email', ''); ?>" target="_blank">ReadyGraph Premium</a> for free.</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  </div>
63
+ <?php } ?>
 
 
 
 
 
 
 
 
64
  <h3 style="font-weight: normal; text-align: center;">Be sure your site profile is accurate!</h3>
65
  <h4 style="font-weight: normal; text-align: center;">This content is used in your site's features and emails</h4>
66
  <div style="margin: 0 5%;">
67
+ <!--<div style="display: block; margin: 10px;"><label for="site_profile_image_upload" style="width: 120px">Site Icon: </label> <input type="file" name="site_profile_image_upload" id="site_profile_image_upload" multiple="false" style="display: inline; margin: 0 0 0 120px" /></div>-->
68
+ <div style="display: block; margin: 10px;"><label for="site_profile_name" style="width: 120px">Site Name:</label><input type="text" name="site_profile_name" id="site_profile_name" value="<?php echo get_option('readygraph_site_name');?>" style="display: inline; margin: 0 0 0 120px" /></div>
69
+ <div style="display: block; margin: 10px;"><label for="site_profile_url" style="width: 120px">Site URL:</label><input type="text" name="site_profile_url" id="site_profile_url" value="<?php echo get_option('readygraph_site_url');?>" style="display: inline; margin: 0 0 0 120px" /></div>
70
+ <div class="site_category" style="display: block; margin: 10px;"><label for="site_category" style="width: 120px">Site Category:</label>
71
+ <select name="site_category" class="dependent-demo2" style="display: inline; margin: 0 0 0 116px" >
72
+ <option></option>
73
+ <option value="animation-comics">Arts and Entertainment||animation and comics</option>
74
+ <option value="architecture">Arts and Entertainment||architecture</option>
75
+ <option value="awards">Arts and Entertainment||awards</option>
76
+ <option value="celebritities-entertainment">Arts and Entertainment||celebritities and entertainment</option>
77
+ <option value="fashion-modeling">Arts and Entertainment||fashion and modeling</option>
78
+ <option value="humor">Arts and Entertainment||humor</option>
79
+ <option value="movies">Arts and Entertainment||movies</option>
80
+ <option value="music-audio">Arts and Entertainment||music and audio</option>
81
+ <option value="performing-arts">Arts and Entertainment||performing arts</option>
82
+ <option value="photography">Arts and Entertainment||photography</option>
83
+ <option value="TV-video">Arts and Entertainment||TV and video</option>
84
+ <option value="web-design">Arts and Entertainment||web design</option>
85
+
86
+ <option value="automotive-industry">Autos and Vehicles||automotive industry</option>
87
+ <option value="automotive-news">Autos and Vehicles||automotive news</option>
88
+ <option value="aviation">Autos and Vehicles||aviation</option>
89
+ <option value="boating">Autos and Vehicles||boating</option>
90
+ <option value="car-buying">Autos and Vehicles||car buying</option>
91
+ <option value="car-rentals">Autos and Vehicles||car rentals</option>
92
+ <option value="makes-model">Autos and Vehicles||makes and models</option>
93
+ <option value="motorcycles">Autos and Vehicles||motorcycles</option>
94
+ <option value="motorsports">Autos and Vehicles||motorsports</option>
95
+ <option value="trains-railroads">Autos and Vehicles||trains and railroads</option>
96
+
97
+ <option value="beauty">Beauty and Fitness||Beauty</option>
98
+ <option value="bodyart">Beauty and Fitness||bodyart</option>
99
+ <option value="cosmetics">Beauty and Fitness||cosmetics</option>
100
+ <option value="fitness">Beauty and Fitness||fitness</option>
101
+ <option value="hair">Beauty and Fitness||hair</option>
102
+ <option value="skin-care">Beauty and Fitness||skin care</option>
103
+ <option value="weight-loss">Beauty and Fitness||weight loss</option>
104
+
105
+ <option value="book-retailers">Books and Literature||book retailers</option>
106
+ <option value="E-books">Books and Literature||E books</option>
107
+ <option value="folklore">Books and Literature||folklore</option>
108
+ <option value="guides-reviews">Books and Literature||guides and reviews</option>
109
+
110
+ <option value="accounting">Business and Industry||accounting</option>
111
+ <option value="aerospace-defense">Business and Industry||aerospace and defense</option>
112
+ <option value="agriculture-forestry">Business and Industry||agriculture and forestry</option>
113
+ <option value="associations">Business and Industry||associations</option>
114
+ <option value="biotechnology-pharmaceutical">Business and Industry||biotechnology and pharmaceutical</option>
115
+ <option value="business-services">Business and Industry||business services</option>
116
+ <option value="chemicals">Business and Industry||chemicals</option>
117
+ <option value="e-commerce">Business and Industry||E commerce</option>
118
+ <option value="energy">Business and Industry||energy</option>
119
+ <option value="industrial-goods-services">Business and Industry||industrial goods and services</option>
120
+ <option value="marketing-advertising">Business and Industry||marketing and advertising</option>
121
+ <option value="metals-mining">Business and Industry||metals and mining</option>
122
+ <option value="publishing-printing">Business and Industry||publishing and printing</option>
123
+ <option value="real-estate">Business and Industry||real estate</option>
124
+ <option value="textiles-nonwovens">Business and Industry||textiles and nonwovens</option>
125
+ <option value="transportation-logistics">Business and Industry||transportation and logistics</option>
126
+ <option value="wholesale-trade">Business and Industry||wholesale trade</option>
127
+
128
+ <option value="business-training">Career and Education||business training</option>
129
+ <option value="education">Career and Education||education</option>
130
+ <option value="human-resources">Career and Education||human resources</option>
131
+ <option value="jobs-employment">Career and Education||jobs and employment</option>
132
+ <option value="universities-colleges">Career and Education||universities and colleges</option>
133
+
134
+ <option value="computer hardware">Computer and Electronics||computer hardware</option>
135
+ <option value="computer security">Computer and Electronics||computer security</option>
136
+ <option value="consumer electronics">Computer and Electronics||consumer electronics</option>
137
+ <option value="graphics and multimedia tools">Computer and Electronics||graphics and multimedia tools</option>
138
+ <option value="mobile computing">Computer and Electronics||mobile computing</option>
139
+ <option value="networking">Computer and Electronics||networking</option>
140
+ <option value="programming">Computer and Electronics||programming</option>
141
+ <option value="software">Computer and Electronics||software</option>
142
+
143
+ <option value="banking">Finance||banking</option>
144
+ <option value="credit-loans-mortgages">Finance||credit, loans and mortgages</option>
145
+ <option value="financial-management">Finance||financial management</option>
146
+ <option value="grants-scholarships">Finance||grants and scholarships</option>
147
+ <option value="insurance">Finance||insurance</option>
148
+ <option value="investing">Finance||investing</option>
149
+
150
+ <option value="beverages">Food and Beverage||beverages</option>
151
+ <option value="catering">Food and Beverage||catering</option>
152
+ <option value="cooking-recipes">Food and Beverage||cooking and recipes</option>
153
+ <option value="food-grocery-retailers">Food and Beverage||food and grocery retailers</option>
154
+ <option value="vegitarian-vegan">Food and Beverage||vegetarian and vegan</option>
155
+
156
+ <option value="bingo">Gambling||bingo</option>
157
+ <option value="casinos">Gambling||casinos</option>
158
+ <option value="lottery">Gambling||lottery</option>
159
+ <option value="poker">Gambling||poker</option>
160
+ <option value="regulation-organizations">Gambling||regulation and organizations</option>
161
+ <option value="sports">Gambling||sports</option>
162
+
163
+ <option value="board-card-games">Games||board and card games</option>
164
+ <option value="miniatures">Games||miniatures</option>
165
+ <option value="online">Games||online</option>
166
+ <option value="puzzles-brainteasers">Games||puzzles and brainteasers</option>
167
+ <option value="roleplaying">Games||roleplaying</option>
168
+ <option value="video-games">Games||video games</option>
169
+
170
+ <option value="addictions">Health||addictions</option>
171
+ <option value="alternative-natural-medicine">Health||alternative natural medicine</option>
172
+ <option value="child-health">Health||child health</option>
173
+ <option value="conditions-diseases">Health||conditions and diseases</option>
174
+ <option value="education-resources">Health||education and resources</option>
175
+ <option value="healthcare-industry">Health||healthcare industry</option>
176
+ <option value="medicine">Health||medicine</option>
177
+ <option value="men-health">Health||men's health</option>
178
+ <option value="mental-health">Health||mental health</option>
179
+ <option value="nutrition">Health||nutrition</option>
180
+ <option value="pharmacy">Health||pharmacy</option>
181
+ <option value="products-shopping">Health||products and shopping</option>
182
+ <option value="public-health-safety">Health||public health and safety</option>
183
+ <option value="reproductive-health">Health||reproductive health</option>
184
+
185
+ <option value="gardening">Home and Garden||gardening</option>
186
+ <option value="home-improvement">Home and Garden||home improvement</option>
187
+ <option value="interior-decor">Home and Garden||interior décor</option>
188
+ <option value="moving-relocating">Home and Garden||moving and relocating</option>
189
+ <option value="nursery-playroom">Home and Garden||nursery and playroom</option>
190
+
191
+ <option value="ad-network">Internet and Telecom||ad network</option>
192
+ <option value="chat-forums">Internet and Telecom||chat and forums</option>
193
+ <option value="domain-names-register">Internet and Telecom||domain names and register</option>
194
+ <option value="email">Internet and Telecom||email</option>
195
+ <option value="file-sharing">Internet and Telecom||file sharing</option>
196
+ <option value="search-engine">Internet and Telecom||search engine</option>
197
+ <option value="social-network">Internet and Telecom||social network</option>
198
+ <option value="telecommunications">Internet and Telecom||telecommunications</option>
199
+ <option value="web-hosting">Internet and Telecom||web hosting</option>
200
+ <option value="content">Internet and Telecom||content</option>
201
+
202
+ <option value="government">Law and Government||government</option>
203
+ <option value="immigration-visas">Law and Government||immigration and visas</option>
204
+ <option value="law">Law and Government||law</option>
205
+ <option value="military-defense">Law and Government||military and defense</option>
206
+
207
+ <option value="news">News and Media||news</option>
208
+ <option value="business-news">News and Media||business news</option>
209
+ <option value="college-university-press">News and Media||college and university press</option>
210
+ <option value="magazines-ezines">News and Media||magazines and E-zines</option>
211
+ <option value="newspapers">News and Media||newspapers</option>
212
+ <option value="sports-news">News and Media||sports news</option>
213
+ <option value="technology-news">News and Media||technology news</option>
214
+ <option value="weather">News and Media||weather</option>
215
+
216
+ <option value="crime-prosecution">People and Society||crime and prosecution</option>
217
+ <option value="death">People and Society||death</option>
218
+ <option value="disabled and special needs">People and Society||disabled and special needs</option>
219
+ <option value="gay-lesbian-bisexual">People and Society||gay, lesbian, and bisexual</option>
220
+ <option value="genealogy">People and Society||genealogy</option>
221
+ <option value="history">People and Society||history</option>
222
+ <option value="holidays">People and Society||holidays</option>
223
+ <option value="philanthropy">People and Society||philanthropy</option>
224
+ <option value="philosophy">People and Society||philosophy</option>
225
+ <option value="relationships-dating">People and Society||relationships and dating</option>
226
+ <option value="religion-spirituality">People and Society||religion and spirituality</option>
227
+ <option value="women-interests">People and Society||women's interests</option>
228
+ <option value="personal-blog">People and Society||personal blog</option>
229
+
230
+ <option value="animal-products-services">Pets and Animals||animal products and services</option>
231
+ <option value="birds">Pets and Animals||birds</option>
232
+ <option value="fish-aquaria">Pets and Animals||fish and aquaria</option>
233
+ <option value="horses">Pets and Animals||horses</option>
234
+ <option value="pets">Pets and Animals||pets</option>
235
+
236
+ <option value="antiques">Recreation and Hobbies||antiques</option>
237
+ <option value="camps">Recreation and Hobbies||camps</option>
238
+ <option value="climbing">Recreation and Hobbies||climbing</option>
239
+ <option value="collecting">Recreation and Hobbies||collecting</option>
240
+ <option value="crafts">Recreation and Hobbies||crafts</option>
241
+ <option value="models">Recreation and Hobbies||models</option>
242
+ <option value="nudism">Recreation and Hobbies||nudism</option>
243
+ <option value="outdoors">Recreation and Hobbies||outdoors</option>
244
+ <option value="scouting">Recreation and Hobbies||scouting</option>
245
+ <option value="theme-parks">Recreation and Hobbies||theme parks</option>
246
+ <option value="tobacco">Recreation and Hobbies||tobacco</option>
247
+
248
+ <option value="archives">Reference||archives</option>
249
+ <option value="ask-expert">Reference||ask an expert</option>
250
+ <option value="dictionary-encyclopaedia">Reference||dictionary and encyclopaedia</option>
251
+ <option value="directories">Reference||directories</option>
252
+ <option value="libraries-museums">Reference||libraries and museums</option>
253
+ <option value="maps">Reference||maps</option>
254
+
255
+ <option value="agriculture">Science||agriculture</option>
256
+ <option value="astronomy">Science||astronomy</option>
257
+ <option value="biology">Science||biology</option>
258
+ <option value="chemistry">Science||chemistry</option>
259
+ <option value="earth-sciences">Science||earth sciences</option>
260
+ <option value="educational-resources">Science||educational resources</option>
261
+ <option value="engineering-technology">Science||engineering and technology</option>
262
+ <option value="environment">Science||environment</option>
263
+ <option value="instruments-supplies">Science||instruments and supplies</option>
264
+ <option value="math">Science||math</option>
265
+ <option value="physics">Science||physics</option>
266
+ <option value="social-sciences">Science||social sciences</option>
267
+
268
+ <option value="antiques-collectibles">Shopping||antiques and collectibles</option>
269
+ <option value="auctions">Shopping||auctions</option>
270
+ <option value="children">Shopping||children</option>
271
+ <option value="classifieds">Shopping||classifieds</option>
272
+ <option value="clothing">Shopping||clothing</option>
273
+ <option value="consumer-electronics">Shopping||consumer electronics</option>
274
+ <option value="coupons">Shopping||coupons</option>
275
+ <option value="ethnic-regional">Shopping||ethnic and regional</option>
276
+ <option value="flowers">Shopping||flowers</option>
277
+ <option value="furniture">Shopping||furniture</option>
278
+ <option value="general-merchandise">Shopping||general merchandise</option>
279
+ <option value="gifts">Shopping||gifts</option>
280
+ <option value="home-garden">Shopping||home and garden</option>
281
+ <option value="jewellery">Shopping||jewellery</option>
282
+ <option value="music">Shopping||music</option>
283
+ <option value="office-products">Shopping||office products</option>
284
+ <option value="publications">Shopping||publications</option>
285
+ <option value="sports">Shopping||sports</option>
286
+ <option value="weddings">Shopping||weddings</option>
287
+
288
+ <option value="baseball">Sports||baseball</option>
289
+ <option value="basketball">Sports||basketball</option>
290
+ <option value="coxing">Sports||coxing</option>
291
+ <option value="cycling-biking">Sports||cycling and biking</option>
292
+ <option value="equestrian">Sports||equestrian</option>
293
+ <option value="extreme-sports">Sports||extreme sports</option>
294
+ <option value="fantasy-sports">Sports||fantasy sports</option>
295
+ <option value="fishing">Sports||fishing</option>
296
+ <option value="football">Sports||football</option>
297
+ <option value="golf">Sports||golf</option>
298
+ <option value="martial-arts">Sports||martial arts</option>
299
+ <option value="rugby">Sports||rugby</option>
300
+ <option value="running">Sports||running</option>
301
+ <option value="soccer">Sports||soccer</option>
302
+ <option value="tennis">Sports||tennis</option>
303
+ <option value="volleyball">Sports||volleyball</option>
304
+ <option value="water-sports">Sports||water sports</option>
305
+ <option value="winter-sports">Sports||winter sports</option>
306
+
307
+ <option value="accommodation-hotels">Travel||accommodation and hotels</option>
308
+ <option value="airlines-airports">Travel||airlines and airports</option>
309
+ <option value="roads-highways">Travel||roads and highways</option>
310
+ <option value="tourism">Travel||tourism</option>
311
+
312
+ <option value="adult">Adult</option>
313
+
314
+
315
+
316
+ </select></div>
317
+ <div class="site_language" style="display: block; margin: 10px;"><label for="site_language" style="width: 120px">Choose your Site language:</label>
318
+ <select name="site_language" id="site_language" style="display: inline; margin: 0 0 0 116px" ><option value="af">Afrikaans</option> <option value="am">Amharic - ‪አማርኛ‬</option> <option value="ar">Arabic - ‫العربية‬</option> <option value="eu">Basque - ‪euskara‬</option> <option value="bn">Bengali - ‪বাংলা‬</option> <option value="bg">Bulgarian - ‪български‬</option> <option value="ca">Catalan - ‪català‬</option> <option value="zh-HK">Chinese (Hong Kong) - ‪中文(香港)‬</option> <option value="zh-CN">Chinese (Simplified) - ‪简体中文‬</option> <option value="zh-TW">Chinese (Traditional) - ‪繁體中文‬</option> <option value="hr">Croatian - ‪Hrvatski‬</option> <option value="cs">Czech - ‪Čeština‬</option> <option value="da">Danish - ‪Dansk‬</option> <option value="nl">Dutch - ‪Nederlands‬</option> <option value="en-GB">English (United Kingdom)</option> <option value="en">English (United States)</option> <option value="et">Estonian - ‪eesti‬</option> <option value="fil">Filipino</option> <option value="fi">Finnish - ‪Suomi‬</option> <option value="fr-CA">French (Canada) - ‪Français (Canada)‬</option> <option value="fr">French (France) - ‪Français (France)‬</option> <option value="gl">Galician - ‪galego‬</option> <option value="de">German - ‪Deutsch‬</option> <option value="el">Greek - ‪Ελληνικά‬</option> <option value="gu">Gujarati - ‪ગુજરાતી‬</option> <option value="iw">Hebrew - ‫עברית‬</option> <option value="hi">Hindi - ‪हिन्दी‬</option> <option value="hu">Hungarian - ‪magyar‬</option> <option value="is">Icelandic - ‪íslenska‬</option> <option value="id">Indonesian - ‪Bahasa Indonesia‬</option> <option value="it">Italian - ‪Italiano‬</option> <option value="ja">Japanese - ‪日本語‬</option> <option value="kn">Kannada - ‪ಕನ್ನಡ‬</option> <option value="ko">Korean - ‪한국어‬</option> <option value="lv">Latvian - ‪latviešu‬</option> <option value="lt">Lithuanian - ‪lietuvių‬</option> <option value="ms">Malay - ‪Bahasa Melayu‬</option> <option value="ml">Malayalam - ‪മലയാളം‬</option> <option value="mr">Marathi - ‪मराठी‬</option> <option value="no">Norwegian - ‪norsk‬</option> <option value="or">Oriya - ‪ଓଡ଼ିଆ‬</option> <option value="fa">Persian - ‫فارسی‬</option> <option value="pl">Polish - ‪polski‬</option> <option value="pt-BR">Portuguese (Brazil) - ‪Português (Brasil)‬</option> <option value="pt-PT">Portuguese (Portugal) - ‪português (Portugal)‬</option> <option value="ro">Romanian - ‪română‬</option> <option value="ru">Russian - ‪Русский‬</option> <option value="sr">Serbian - ‪српски‬</option> <option value="sk">Slovak - ‪Slovenčina‬</option> <option value="sl">Slovenian - ‪slovenščina‬</option> <option value="es-419">Spanish (Latin America) - ‪Español (Latinoamérica)‬</option> <option value="es">Spanish (Spain) - ‪Español (España)‬</option> <option value="sw">Swahili - ‪Kiswahili‬</option> <option value="sv">Swedish - ‪Svenska‬</option> <option value="ta">Tamil - ‪தமிழ்‬</option> <option value="te">Telugu - ‪తెలుగు‬</option> <option value="th">Thai - ‪ไทย‬</option> <option value="tr">Turkish - ‪Türkçe‬</option> <option value="uk">Ukrainian - ‪Українська‬</option> <option value="ur">Urdu - ‫اردو‬</option> <option value="vi">Vietnamese - ‪Tiếng Việt‬</option> <option value="zu">Zulu - ‪isiZulu‬</option></select></p>
319
  <div style="display: block; width:50%">
320
+ <label for="sitedesceditor" style="display: block; width: 120px">Site Description:</label><div style="margin-left: 240px;margin-top: -20px"><?php /**
321
 
322
  /**
323
  * Basic syntax
334
  ?>
335
  </div>
336
  </div>
337
+ </div>
338
+ <div class="save-changes"><?php if(get_option('readygraph_tutorial') && get_option('readygraph_tutorial') == "true"){ ?><button type="submit" class="btn btn-large btn-warning save-next" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup" style="float: right;margin: 15px">Save Changes & Next</button><?php } ?>
339
+ <button type="submit" class="btn btn-large btn-warning save" formaction="#" style="float: right;margin: 15px">Save Changes</button>
340
+ <?php if(get_option('readygraph_tutorial') && get_option('readygraph_tutorial') == "true"){ ?><button type="submit" class="btn btn-large btn-warning save-previous" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=basic-settings&tutorial=true" style="float: right;margin: 15px">Previous</button> <?php } ?>
341
  </div>
342
  </div>
343
  </div>
344
  </form>
 
 
 
 
 
 
 
 
 
345
 
346
+ <script type="text/javascript" charset="utf-8">
347
+ var $ = jQuery;
348
+ var category = $('[name="readygraph_site_category"]').val();
349
+ if (category != ""){
350
+ $('#site_category').val(category);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
  }
352
+ var language = $('[name="readygraph_site_language"]').val();
353
+ if (language != ""){
354
+ $('#site_language').val(language);
 
 
 
 
 
 
 
 
355
  }
356
  </script>
357
+ <?php include("footer.php"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
extension/readygraph/social-feed.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Represents the view for the administration dashboard.
4
  *
@@ -11,24 +12,9 @@
11
  * @link http://www.readygraph.com
12
  * @copyright 2014 Your Name or Company Name
13
  */
14
-
15
- function s2_disconnectReadyGraph(){
16
- $app_id = get_option('readygraph_application_id');
17
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=disconnect_readygraph&app_id=$app_id" );
18
- s2_delete_rg_options();
19
- }
20
- function s2_deleteReadyGraph(){
21
- $app_id = get_option('readygraph_application_id');
22
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=uninstall_readygraph&app_id=$app_id" );
23
- s2_delete_rg_options();
24
- $dir = plugin_dir_path( __FILE__ );
25
- s2_rrmdir($dir);
26
- }
27
 
28
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "changeaccount")s2_disconnectReadyGraph();
29
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "deleteaccount")s2_deleteReadyGraph();
30
-
31
- global $main_plugin_title;
32
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
33
  //redirect to main page
34
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
@@ -63,79 +49,17 @@ s2_rrmdir($dir);
63
  }
64
  }
65
  ?>
66
-
67
- <link rel="stylesheet" type="text/css" href="<?php echo plugins_url( 'assets/css/admin.css', __FILE__ ) ?>">
68
- <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/admin.js', __FILE__ ) ?>"></script>
69
  <form method="post" id="myForm">
70
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
71
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
72
  <input type="hidden" name="readygraph_email" value="<?php echo get_option('readygraph_email', '') ?>">
73
  <input type="hidden" name="readygraph_application_id" value="<?php echo get_option('readygraph_application_id', '') ?>">
74
  <input type="hidden" name="readygraph_enable_sidebar" value="<?php echo get_option('readygraph_enable_sidebar', 'false') ?>">
75
-
76
- <style>a.help-tooltip {outline:none; }a.help-tooltip strong {line-height:30px;}a.help-tooltip:hover {text-decoration:none;} a.help-tooltip span { z-index:10;display:none; padding:14px 20px; margin-top:40px; margin-left:-150px; width:300px; line-height:16px;}a.help-tooltip:hover span{ display:inline; position:absolute; border:2px solid #FFF; background:#fff; text-align: justify; z-index:1000000000;}.callout {z-index:1000000000;position:absolute;border:0;top:-14px;left:120px;} /*CSS3 extras*/a.help-tooltip span{ border-radius:2px; -moz-border-radius: 2px; -webkit-border-radius: 2px; -moz-box-shadow: 0px 0px 8px 4px #666; -webkit-box-shadow: 0px 0px 8px 4px #666; box-shadow: 0px 0px 8px 4px #666;}</style>
77
- <div class="authenticated" style="display: none;">
78
- <div style="background-color: #2961cb; min-width: 90%; height: 50px;margin-right: 1%;">
79
- <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/white-logo.png" style="width: 138px; height: 30px; margin: 10px 0 0 15px; float: left;">
80
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
81
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
82
- <span class="email-address" style="text-shadow: none;"></span> <span class="caret"></span>
83
- </button>
84
- <ul class="dropdown-menu">
85
- <li><a class="change-account" href="#">Change Account</a></li>
86
- <li><a class="disconnect" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("changeaccount");?>">Disconnect</a></li>
87
- <li><a class="delete" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&action=<?php echo base64_encode("deleteaccount");?>">Delete ReadyGraph</a></li>
88
- </ul>
89
- </div>
90
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
91
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
92
- <span class="result" style="text-shadow: none;">...</span> <span class="caret"></span>
93
- </button>
94
- <ul class="dropdown-menu">
95
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Insights</a></li>
96
- </ul>
97
- </div>
98
- <div style="clear: both;"></div>
99
- </div>
100
- <!-- write menu code-->
101
- <div class="readygraph-menu">
102
- <div class="menu-tabs"><h4>Grow Users</h4>
103
- <ul>
104
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
105
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
106
- <li><a href="#"></a></li>
107
- </ul>
108
- </div>
109
- <div class="menu-tabs"><h4>Email Users</h4>
110
- <ul>
111
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
112
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
113
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
114
- </ul>
115
- </div>
116
- <div class="menu-tabs"><h4>Engage Users</h4>
117
- <ul>
118
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed">Social Feed</a></li>
119
- <li><a href="#">Social Followers</a></li>
120
- <li><a href="#">Feedback Survey</a></li>
121
- </ul>
122
- </div>
123
- <div class="menu-tabs"><h4>Basic Settings</h4>
124
- <ul>
125
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
126
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=feature-settings">Feature Settings</a></li>
127
-
128
- </ul>
129
- </div>
130
- <div class="menu-tabs" style="float:right"><h4>&nbsp;</h4>
131
- <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
132
- <p>
133
- <a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=faq" style="color: #b1c1ca" >FAQ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/10.png" /></a></p>
134
-
135
- </ul>
136
- </div>
137
- </div>
138
  <div><a href="#">Engage Users</a> > Social Feed</div>
 
 
 
 
139
  <div class="social-feed" style="margin: 2% auto; width: 80%">
140
 
141
  <h3 style="font-weight: normal; text-align: center;">Enable your social feed sidebar to build a community (Optional)</h3>
@@ -151,377 +75,13 @@ s2_rrmdir($dir);
151
  <option value="false">NO</option>
152
  </select><a href="#" class="help-tooltip"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/Help-icon.png" width="15px" style="margin-left:10px;"/><span><img class="callout" src="<?php echo plugin_dir_url( __FILE__ );?>assets/callout_black.gif" /><strong>ReadyGraph Social Feed Settings</strong><br />You can add an optional social sidebar to your site that allows users the ability to share and discuss the best content on your site. For an example, click here.<br /></span></a>
153
  </p><br />
154
- <div class="save-changes"><button type="submit" class="btn btn-large btn-warning save-next" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=customize-emails&source=social-feed" style="float: right;margin: 15px">Save Changes & Next</button>
155
  <button type="submit" class="btn btn-large btn-warning save" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed" style="float: right;margin: 15px">Save Changes</button>
156
- <button type="submit" class="btn btn-large btn-warning save-previous" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup" style="float: right;margin: 15px">Previous</button>
157
  </div>
158
  </div>
159
 
160
  </div>
161
  </div>
162
- </div>
163
  </form>
164
- <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
165
- <script type="text/javascript" charset="utf-8">
166
- var $ = jQuery;
167
- $(function () {
168
- var settings =
169
- {
170
- 'host': "www.readygraph.com"
171
- , 'clientId': "9838eb84c6da2fc44ab9"
172
- };
173
-
174
- var authHost = "https://" + settings.host;
175
- var resourceHost = "https://" + settings.host;
176
-
177
- // OAuth 2.0 Popup
178
- //
179
- var popupWindow=null;
180
- function openPopup(url)
181
- {
182
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
183
- else popupWindow = window.open(url,"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=515, height=330,top=" + (screen.height - 330)/2 + ",left=" + (screen.width - 515)/2);
184
- }
185
- function parent_disable() {
186
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
187
- }
188
-
189
- $("a.connect").click(function() {
190
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
191
- openPopup(url);
192
- $(document.body).bind('focus', parent_disable);
193
- $(document.body).bind('click', parent_disable);
194
- });
195
- $(".change-account").click(function() {
196
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
197
- var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
198
- openPopup(logout);
199
- $(document.body).bind('focus', parent_disable);
200
- $(document.body).bind('click', parent_disable);
201
- });
202
-
203
- // User Interface
204
- //
205
- $('.template').click(function() {
206
- $('#preview').attr('src', $(this).find('img').attr('src'));
207
- });
208
-
209
- // Manage OAuth 2.0 Redirect
210
- //
211
- var extractCode = function(hash) {
212
- var match = hash.match(/code=(\w+)/);
213
- return !!match && match[1];
214
- };
215
- var extractToken = function(hash) {
216
- var match = hash.match(/access_token=(\w+)/);
217
- return !!match && match[1];
218
- };
219
- var extractError = function(hash) {
220
- var match = hash.match(/error=(\w+)/);
221
- return !!match && match[1];
222
- };
223
-
224
- var code = extractCode(window.location.href);
225
- if (extractError(window.location.href) == 'access_denied') {
226
- window.close();
227
- }
228
- else if(code) {
229
- try { window.opener.setCode(code); }
230
- catch(ex) { }
231
- window.close();
232
- }
233
- else {
234
- $('.rgw-fb-login-button-iframe').hide();
235
- $('div.authenticate').show();
236
-
237
- if ($('[name="readygraph_access_token"]').val()) {
238
- $('.rgw-fb-login-button-iframe').show();
239
- $('div.authenticate').hide();
240
- $('div.authenticating').hide();
241
- $('div.authenticated').show();
242
-
243
- $('.email-address').text($('[name="readygraph_email"]').val());
244
-
245
- window.setup_readygraph($('[name="readygraph_application_id"]').val());
246
- $('.sidebar').val($('[name="readygraph_enable_sidebar"]').val());
247
-
248
- //$('[name="readygraph_ad_format"][value="' + $('[name="_readygraph_ad_format"]').val() + '"]').parent().click();
249
- //$('[name="readygraph_ad_timing"][value="' + $('[name="_readygraph_ad_timing"]').val() + '"]').parent().click();
250
-
251
- //$('[name="readygraph_ad_delay"]').val($('[name="_readygraph_ad_delay"]').val());
252
- //$('[name="readygraph_ad_scroll"]').val($('[name="_readygraph_ad_scroll"]').val());
253
-
254
- $('.result').text('...');
255
- if ($('[name="readygraph_access_token"]').val()) {
256
- $.ajax({
257
- url: resourceHost + '/api/v1/insight_info'
258
- , beforeSend: function (xhr) {
259
- xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
260
- xhr.setRequestHeader('Accept', "application/json");
261
- }
262
- , method: 'POST'
263
- , success: function (response) {
264
- if (response.data) {
265
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
266
- } else {
267
- $('.result').text('Insight');
268
- }
269
- }
270
- , error: function (response) {
271
- refresh_access_token();
272
- }
273
- });
274
- }
275
- }
276
- }
277
-
278
- // Manage OAuth 2.0 Results
279
- //
280
- function refresh_access_token() {
281
- var refresh_token = $('[name="readygraph_refresh_token"]').val();
282
- if (refresh_token) {
283
- $('div.authenticate').hide();
284
- $('div.authenticating').show();
285
- $('div.authenticated').hide();
286
-
287
- $.ajax({
288
- url: resourceHost + '/oauth/access_token'
289
- , data: {
290
- grant_type: 'refresh_token',
291
- refresh_token: $('[name="readygraph_refresh_token"]').val(),
292
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
293
- client_id: settings.clientId
294
- }
295
- , method: 'POST'
296
- , success: function (response) {
297
- $('[name="readygraph_access_token"]').val(response.access_token);
298
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
299
- window.setAccessToken(response.access_token);
300
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
301
- }
302
- , error: function (response) {
303
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
304
- $('div.authenticate').show();
305
- $('div.authenticating').hide();
306
- $('div.authenticated').hide();
307
- }
308
- });
309
- }
310
- }
311
- window.setCode = function(code) {
312
- $('.rgw-fb-login-button-iframe').hide();
313
- $('div.authenticate').hide();
314
- $('div.authenticating').show();
315
- $('div.authenticated').hide();
316
-
317
- $.ajax({
318
- url: resourceHost + '/oauth/access_token'
319
- , data: {
320
- grant_type: 'authorization_code',
321
- code: code,
322
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
323
- client_id: settings.clientId
324
- }
325
- , method: 'POST'
326
- , success: function (response) {
327
- if (response) {
328
- $('[name="readygraph_access_token"]').val(response.access_token);
329
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
330
- window.setAccessToken(response.access_token);
331
- } else {
332
- $('div.authenticating').hide();
333
- $('div.authenticate').show();
334
- }
335
- }
336
- });
337
- }
338
- window.setAccessToken = function(token) {
339
- $('.rgw-fb-login-button-iframe').hide();
340
- $('div.authenticate').hide();
341
- $('div.authenticating').show();
342
- $('div.authenticated').hide();
343
-
344
- $.ajax({
345
- url: resourceHost + '/api/v1/account_info'
346
- , beforeSend: function (xhr) {
347
- xhr.setRequestHeader('Authorization', "Bearer " + token);
348
- xhr.setRequestHeader('Accept', "application/json");
349
- }
350
- , method: 'POST'
351
- , success: function (response) {
352
- if (response.data) {
353
- $('[name="readygraph_access_token"]').val(token);
354
- $('[name="readygraph_email"]').val(response.data.email);
355
- $('[name="readygraph_application_id"]').val(response.data.application_id);
356
- $('#myForm')[0].submit();
357
- } else {
358
- $('div.authenticating').hide();
359
- $('div.authenticate').show();
360
- $('.rgw-fb-login-button-iframe').hide();
361
- }
362
- }
363
- });
364
- }
365
- });
366
- </script>
367
- <script>
368
- window.setup = false;
369
- window.refresh_readygraph = function() {};
370
- window.setup_readygraph = function(app_id) {
371
- if (window.setup) {
372
- window.refresh_readygraph();
373
- return;
374
- }
375
- window.setup = true;
376
- readygraph.setup({
377
- applicationId: app_id,
378
- isPreview: true,
379
- enableLoginWall: false,
380
- enableDistraction: false,
381
- enableAutoLogin: false,
382
- enableSidebar: false,
383
- enableNotification: false,
384
- enableInvite: false,
385
- enableOpenGraph: false,
386
- enableRgSeo: false
387
- });
388
- readygraph.ready(function() {
389
- readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
390
- var $ = readygraph.framework.jQuery;
391
- $.cookie('RGAuth', null);
392
- readygraph.framework.facebook.logout(function() {
393
- readygraph.framework.require(['invite'], function() {
394
- var VIEW_TYPE = {
395
- LOADING: 0,
396
- LOGIN_REQUIRE: 1,
397
- PERMISSION_REQUIRE: 2,
398
- DEFAULT: 3,
399
- LOGIN_WITH_EMAIL: 4,
400
- SIGNUP_WITH_EMAIL: 5,
401
- IMPORT_WITH_EMAIL: 6,
402
- FINISH: 10
403
- };
404
-
405
- var auth = new readygraph.framework.ui.AuthModel({
406
- dialog: true,
407
- 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
408
- });
409
- $('.rg-preview-widget').html('');
410
- $('.rg-preview-widget').append(auth.lightbox.view.$el);
411
- $('.rgw-content').attr('style', 'position: relative !important;');
412
-
413
- var view = VIEW_TYPE.LOGIN_REQUIRE;
414
- auth.on('switch', function() {
415
- if (auth.view.currentView != view) { auth.view.switchView(view); }
416
- else auth.view.render();
417
- if (view == VIEW_TYPE.DEFAULT) {
418
- auth.view.$el.find('.rgw-invite-view').showAndAnimate();
419
- auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
420
- auth.view.$el.commitTransition();
421
- }
422
- });
423
- auth.view.switchView(view);
424
-
425
- $(window).scroll(function() {
426
- $(window).trigger('rgw-invalidate');
427
- });
428
- $('.rg-preview-widget, .content-warp').scroll(function() {
429
- $(window).trigger('rgw-invalidate');
430
- });
431
- $(window).trigger('rgw-invalidate');
432
-
433
- $('.rg-vertical-tab').click(function() {
434
- saveContent(auth, $('.rg-preview-widget-container'), true);
435
-
436
- $('.rg-vertical-tab').removeClass('active');
437
- $(this).addClass('active');
438
- view = VIEW_TYPE[$(this).attr('tab')];
439
- if (auth.view.currentView != view) { auth.view.switchView(view); }
440
-
441
- $('.rg-preview-widget, .content-warp').scrollTop(10000);
442
- });
443
-
444
- enableContentEditable(auth, $('.rg-preview-widget-container'));
445
- restoreContent(auth, $('.rg-preview-widget-container'));
446
-
447
- $('.save').click(function() {
448
- $('.save').css('opacity', 0.4);
449
- saveContent(auth, $('.rg-preview-widget-container'), false);
450
- });
451
-
452
- window.refresh_readygraph = function() {
453
- restoreContent(auth, $('.rg-preview-widget-container'));
454
- }
455
- });
456
- });
457
- });
458
- });
459
- }
460
- function enableContentEditable(model, container) {
461
- model.view.$el.find('[rgw-data-key]').each(function() {
462
- var element = $(this);
463
- if (element.attr('rgw-data-editable') == 'false') return;
464
-
465
- if (element.attr('editing') != null) return;
466
- container.find('.special-button-container button').attr('disabled', 'disabled');
467
- element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
468
- element.attr('editing', '1');
469
- element.css({
470
- 'border': '2px dashed orange',
471
- 'position': 'relative',
472
- 'top': '-2px',
473
- 'margin-bottom': '-4px',
474
- 'background-color': '#FAFAC5'
475
- });
476
- element.attr('contenteditable', true);
477
- element.bind('paste', function(e) {
478
- e.preventDefault();
479
- });
480
- element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
481
- });
482
- }
483
- function saveContent(model, container, fake) {
484
- var settings = {};
485
- model.view.$el.find('[rgw-data-key]').each(function() {
486
- var element = $(this);
487
- if (element.attr('rgw-data-editable') == 'false') return;
488
- settings[element.attr('rgw-data-key')] = element.text();
489
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
490
- });
491
- if (!fake) {
492
- $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
493
- $('#myForm')[0].submit();
494
- }
495
- }
496
- function restoreContent(model, container) {
497
- eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
498
- var settings = window._TEMP;
499
- if (settings) {
500
- model.view.$el.find('[rgw-data-key]').each(function() {
501
- var element = $(this);
502
- if (element.attr('rgw-data-editable') == 'false') return;
503
- element.text(settings[element.attr('rgw-data-key')]);
504
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
505
- });
506
- }
507
- }
508
- </script>
509
- <style>
510
- /* FOR INLINE WIDGET */
511
- .rgw-overlay {
512
- display: none !important;
513
- }
514
- .rgw-content-frame {
515
- left: 0 !important;
516
- top: 0 !important;
517
- position: relative !important;
518
- margin: 0 auto !important;
519
- border: solid 1px #cccccc;
520
- }
521
- .rgw-preview-warning {
522
- display: none !important;
523
- }
524
- .rgw-content {
525
- position: relative !important;
526
- }
527
- </style>
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
  /**
4
  * Represents the view for the administration dashboard.
5
  *
12
  * @link http://www.readygraph.com
13
  * @copyright 2014 Your Name or Company Name
14
  */
15
+ include("header.php");
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
+ if(isset($_GET["readygraph_upgrade_notice"]) && $_GET["readygraph_upgrade_notice"] == "dismiss") {update_option('readygraph_upgrade_notice', 'false');}
 
 
 
18
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
19
  //redirect to main page
20
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
49
  }
50
  }
51
  ?>
 
 
 
52
  <form method="post" id="myForm">
53
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
54
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
55
  <input type="hidden" name="readygraph_email" value="<?php echo get_option('readygraph_email', '') ?>">
56
  <input type="hidden" name="readygraph_application_id" value="<?php echo get_option('readygraph_application_id', '') ?>">
57
  <input type="hidden" name="readygraph_enable_sidebar" value="<?php echo get_option('readygraph_enable_sidebar', 'false') ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  <div><a href="#">Engage Users</a> > Social Feed</div>
59
+ <?php if(get_option('readygraph_upgrade_notice') && get_option('readygraph_upgrade_notice') == "true") { ?><div class="upgrade-notice"><div class="aa_close"><a href="<?php echo $_SERVER['REQUEST_URI']; ?>&readygraph_upgrade_notice=dismiss"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/dialog_close.png"></a></div>
60
+ <div class="upgrade-notice-text">Want to grow your users even faster? Try <a href="https://readygraph.com/accounts/payment/?email=<?php echo get_option('readygraph_email', ''); ?>" target="_blank">ReadyGraph Premium</a> for free.</div>
61
+ </div>
62
+ <?php } ?>
63
  <div class="social-feed" style="margin: 2% auto; width: 80%">
64
 
65
  <h3 style="font-weight: normal; text-align: center;">Enable your social feed sidebar to build a community (Optional)</h3>
75
  <option value="false">NO</option>
76
  </select><a href="#" class="help-tooltip"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/Help-icon.png" width="15px" style="margin-left:10px;"/><span><img class="callout" src="<?php echo plugin_dir_url( __FILE__ );?>assets/callout_black.gif" /><strong>ReadyGraph Social Feed Settings</strong><br />You can add an optional social sidebar to your site that allows users the ability to share and discuss the best content on your site. For an example, click here.<br /></span></a>
77
  </p><br />
78
+ <div class="save-changes"><?php if(get_option('readygraph_tutorial') && get_option('readygraph_tutorial') == "true"){ ?><button type="submit" class="btn btn-large btn-warning save-next" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=customize-emails&source=social-feed" style="float: right;margin: 15px">Save Changes & Next</button><?php } ?>
79
  <button type="submit" class="btn btn-large btn-warning save" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed" style="float: right;margin: 15px">Save Changes</button>
80
+ <?php if(get_option('readygraph_tutorial') && get_option('readygraph_tutorial') == "true"){ ?><button type="submit" class="btn btn-large btn-warning save-previous" formaction="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup" style="float: right;margin: 15px">Previous</button><?php } ?>
81
  </div>
82
  </div>
83
 
84
  </div>
85
  </div>
 
86
  </form>
87
+ <?php include("footer.php"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
include/Sign-Alert-icon.png ADDED
Binary file
include/counterwidget.php CHANGED
@@ -3,48 +3,48 @@ class S2_Counter_widget extends WP_Widget {
3
  /**
4
  Declares the S2_Counter_widget class.
5
  */
6
- function S2_Counter_widget() {
7
- $widget_options = array('classname' => 's2_counter', 'description' => __('Subscriber Counter widget for Subscribe2', 'subscribe2') );
8
- $control_options = array('width' => 250, 'height' => 500);
9
- $this->WP_Widget('s2_counter', __('Subscribe2 Counter', 'subscribe2'), $widget_options, $control_options);
10
  }
11
 
12
  /**
13
  Displays the Widget
14
  */
15
- function widget($args, $instance) {
16
- $title = empty($instance['title']) ? 'Subscriber Count' : $instance['title'];
17
- $s2w_bg = empty($instance['s2w_bg']) ? '#e3dacf' : $instance['s2w_bg'];
18
- $s2w_fg = empty($instance['s2w_fg']) ? '#345797' : $instance['s2w_fg'];
19
- $s2w_width = empty($instance['s2w_width']) ? '82' : $instance['s2w_width'];
20
- $s2w_height = empty($instance['s2w_height']) ? '16' : $instance['s2w_height'];
21
- $s2w_font = empty($instance['s2w_font']) ? '11' : $instance['s2w_font'];
22
 
23
  echo $args['before_widget'];
24
- if ( !empty($title) ) {
25
  echo $args['before_title'] . $title . $args['after_title'];
26
  }
27
  global $mysubscribe2;
28
  $registered = $mysubscribe2->get_registered();
29
  $confirmed = $mysubscribe2->get_public();
30
- $count = (count($registered) + count($confirmed));
31
- echo "<ul><div style=\"text-align:center; background-color:" . $s2w_bg . "; color:" . $s2w_fg . "; width:" . $s2w_width . "px; height:" . $s2w_height . "px; font:" . $s2w_font . "pt Verdana, Arial, Helvetica, sans-serif; vertical-align:middle; padding:3px; border:1px solid #444;\">";
32
  echo $count;
33
- echo "</div></ul>";
34
  echo $args['after_widget'];
35
  }
36
 
37
  /**
38
  Saves the widgets settings.
39
  */
40
- function update($new_instance, $old_instance) {
41
  $instance = $old_instance;
42
- $instance['title'] = strip_tags(stripslashes($new_instance['title']));
43
- $instance['s2w_bg'] = strip_tags(stripslashes($new_instance['s2w_bg']));
44
- $instance['s2w_fg'] = strip_tags(stripslashes($new_instance['s2w_fg']));
45
- $instance['s2w_width'] = strip_tags(stripslashes($new_instance['s2w_width']));
46
- $instance['s2w_height'] = strip_tags(stripslashes($new_instance['s2w_height']));
47
- $instance['s2w_font'] = strip_tags(stripslashes($new_instance['s2w_font']));
48
 
49
  return $instance;
50
  }
@@ -52,47 +52,47 @@ class S2_Counter_widget extends WP_Widget {
52
  /**
53
  Creates the edit form for the widget.
54
  */
55
- function form($instance) {
56
  // set some defaults
57
- $options = get_option('widget_s2counter');
58
- if ( $options === false ) {
59
- $defaults = array('title'=>'Subscriber Count', 's2w_bg'=>'#e3dacf', 's2w_fg'=>'#345797', 's2w_width'=>'82', 's2w_height'=>'16', 's2w_font'=>'11');
60
  } else {
61
- $defaults = array('title'=>$options['title'], 's2w_bg'=>$options['s2w_bg'], 's2w_fg'=>$options['s2w_fg'], 's2w_width'=>$options['s2w_width'], 's2w_height'=>$options['s2w_height'], 's2w_font'=>$options['s2w_font']);
62
- delete_option('widget_s2counter');
63
  }
64
- $instance = wp_parse_args( (array) $instance, $defaults);
65
  // Be sure you format your options to be valid HTML attributes.
66
- $s2w_title = htmlspecialchars($instance['title'], ENT_QUOTES);
67
- $s2w_bg = htmlspecialchars($instance['s2w_bg'], ENT_QUOTES);
68
- $s2w_fg = htmlspecialchars($instance['s2w_fg'], ENT_QUOTES);
69
- $s2w_width = htmlspecialchars($instance['s2w_width'], ENT_QUOTES);
70
- $s2w_height = htmlspecialchars($instance['s2w_height'], ENT_QUOTES);
71
- $s2w_font = htmlspecialchars($instance['s2w_font'], ENT_QUOTES);
72
- echo "<div>\r\n";
73
- echo "<fieldset><legend><label for=\"" . $this->get_field_id('title') . "\">" . __('Widget Title', 'subscribe2') . "</label></legend>\r\n";
74
- echo "<input type=\"text\" name=\"" . $this->get_field_name('title') . "\" id=\"" . $this->get_field_id('title') . "\" value=\"" . $s2w_title . "\" />\r\n";
75
- echo "</fieldset>\r\n";
76
 
77
- echo "<fieldset>\r\n";
78
- echo "<legend>" . __('Color Scheme', 'subscribe2') . "</legend>\r\n";
79
- echo "<label>\r\n";
80
- echo "<input type=\"text\" name=\"" . $this->get_field_name('s2w_bg') . "\" id=\"" . $this->get_field_id('s2w_bg') . "\" maxlength=\"6\" value=\"" . $s2w_bg . "\" class=\"colorpickerField\" style=\"width:60px;\" /> " . __('Body', 'subscribe2') . "</label><br />\r\n";
81
- echo "<label>\r\n";
82
- echo "<input type=\"text\" name=\"" . $this->get_field_name('s2w_fg') . "\" id=\"" . $this->get_field_id('s2w_fg') . "\" maxlength=\"6\" value=\"" . $s2w_fg . "\" class=\"colorpickerField\" style=\"width:60px;\" /> " . __('Text', 'subscribe2') . "</label><br />\r\n";
83
- echo "<div class=\"s2_colorpicker\" id =\"" . $this->get_field_id('s2_colorpicker') . "\"></div>";
84
- echo "</fieldset>";
85
 
86
- echo "<fieldset>\r\n";
87
- echo "<legend>" . __('Width, Height and Font Size', 'subscribe2') . "</legend>\r\n";
88
- echo "<table style=\"border:0; padding:0; margin:0 0 12px 0; border-collapse:collapse;\" align=\"center\">\r\n";
89
- echo "<tr><td><label for=\"" . $this->get_field_id('s2w_width') . "\">" . __('Width', 'subscribe2') . "</label></td>\r\n";
90
- echo "<td><input type=\"text\" name=\"" . $this->get_field_name('s2w_width') . "\" id=\"" . $this->get_field_id('s2w_width') . "\" value=\"" . $s2w_width . "\" /></td></tr>\r\n";
91
- echo "<tr><td><label for=\"" . $this->get_field_id('s2w_height') . "\">" . __('Height', 'subscribe2') . "</label></td>\r\n";
92
- echo "<td><input type=\"text\" name=\"" . $this->get_field_name('s2w_height') . "\" id=\"" . $this->get_field_id('s2w_height') . "\" value=\"" . $s2w_height . "\" /></td></tr>\r\n";
93
- echo "<tr><td><label for=\"" . $this->get_field_id('s2w_font') . "\">" . __('Font', 'subscribe2') . "</label></td>\r\n";
94
- echo "<td><input type=\"text\" name=\"" . $this->get_field_name('s2w_font') . "\" id=\"" . $this->get_field_id('s2w_font') . "\" value=\"" . $s2w_font . "\" /></td></tr>\r\n";
95
- echo "</table></fieldset></div>\r\n";
96
  }
97
  }// end S2_Counter_widget class
98
  ?>
3
  /**
4
  Declares the S2_Counter_widget class.
5
  */
6
+ function __construct() {
7
+ $widget_options = array( 'classname' => 's2_counter', 'description' => esc_html__( 'Subscriber Counter widget for Subscribe2', 'subscribe2' ) );
8
+ $control_options = array( 'width' => 250, 'height' => 500 );
9
+ parent::__construct( 's2_counter', esc_html__( 'Subscribe2 Counter', 'subscribe2' ), $widget_options, $control_options );
10
  }
11
 
12
  /**
13
  Displays the Widget
14
  */
15
+ function widget( $args, $instance ) {
16
+ $title = empty( $instance['title'] ) ? 'Subscriber Count' : $instance['title'];
17
+ $s2w_bg = empty( $instance['s2w_bg'] ) ? '#e3dacf' : $instance['s2w_bg'];
18
+ $s2w_fg = empty( $instance['s2w_fg'] ) ? '#345797' : $instance['s2w_fg'];
19
+ $s2w_width = empty( $instance['s2w_width'] ) ? '82' : $instance['s2w_width'];
20
+ $s2w_height = empty( $instance['s2w_height'] ) ? '16' : $instance['s2w_height'];
21
+ $s2w_font = empty( $instance['s2w_font'] ) ? '11' : $instance['s2w_font'];
22
 
23
  echo $args['before_widget'];
24
+ if ( ! empty( $title ) ) {
25
  echo $args['before_title'] . $title . $args['after_title'];
26
  }
27
  global $mysubscribe2;
28
  $registered = $mysubscribe2->get_registered();
29
  $confirmed = $mysubscribe2->get_public();
30
+ $count = (count( $registered ) + count( $confirmed ));
31
+ echo '<ul><div style="text-align:center; background-color:' . $s2w_bg . '; color:' . $s2w_fg . '; width:' . $s2w_width . 'px; height:' . $s2w_height . 'px; font:' . $s2w_font . 'pt Verdana, Arial, Helvetica, sans-serif; vertical-align:middle; padding:3px; border:1px solid #444;">';
32
  echo $count;
33
+ echo '</div></ul>';
34
  echo $args['after_widget'];
35
  }
36
 
37
  /**
38
  Saves the widgets settings.
39
  */
40
+ function update( $new_instance, $old_instance ) {
41
  $instance = $old_instance;
42
+ $instance['title'] = strip_tags( stripslashes( $new_instance['title'] ) );
43
+ $instance['s2w_bg'] = strip_tags( stripslashes( $new_instance['s2w_bg'] ) );
44
+ $instance['s2w_fg'] = strip_tags( stripslashes( $new_instance['s2w_fg'] ) );
45
+ $instance['s2w_width'] = strip_tags( stripslashes( $new_instance['s2w_width'] ) );
46
+ $instance['s2w_height'] = strip_tags( stripslashes( $new_instance['s2w_height'] ) );
47
+ $instance['s2w_font'] = strip_tags( stripslashes( $new_instance['s2w_font'] ) );
48
 
49
  return $instance;
50
  }
52
  /**
53
  Creates the edit form for the widget.
54
  */
55
+ function form( $instance ) {
56
  // set some defaults
57
+ $options = get_option( 'widget_s2counter' );
58
+ if ( false === $options ) {
59
+ $defaults = array( 'title' => 'Subscriber Count', 's2w_bg' => '#e3dacf', 's2w_fg' => '#345797', 's2w_width' => '82', 's2w_height' => '16', 's2w_font' => '11' );
60
  } else {
61
+ $defaults = array( 'title' => $options['title'], 's2w_bg' => $options['s2w_bg'], 's2w_fg' => $options['s2w_fg'], 's2w_width' => $options['s2w_width'], 's2w_height' => $options['s2w_height'], 's2w_font' => $options['s2w_font'] );
62
+ delete_option( 'widget_s2counter' );
63
  }
64
+ $instance = wp_parse_args( (array) $instance, $defaults );
65
  // Be sure you format your options to be valid HTML attributes.
66
+ $s2w_title = htmlspecialchars( $instance['title'], ENT_QUOTES );
67
+ $s2w_bg = htmlspecialchars( $instance['s2w_bg'], ENT_QUOTES );
68
+ $s2w_fg = htmlspecialchars( $instance['s2w_fg'], ENT_QUOTES );
69
+ $s2w_width = htmlspecialchars( $instance['s2w_width'], ENT_QUOTES );
70
+ $s2w_height = htmlspecialchars( $instance['s2w_height'], ENT_QUOTES );
71
+ $s2w_font = htmlspecialchars( $instance['s2w_font'], ENT_QUOTES );
72
+ echo '<div>' . "\r\n";
73
+ echo '<fieldset><legend><label for="' . esc_attr( $this->get_field_id( 'title' ) ) . '">' . esc_html__( 'Widget Title', 'subscribe2' ) . '</label></legend>' . "\r\n";
74
+ echo '<input type="text" name="' . esc_attr( $this->get_field_name( 'title' ) ) . '" id="' . esc_attr( $this->get_field_id( 'title' ) ) . '" value="' . esc_html__( $s2w_title ) . '" />' . "\r\n";
75
+ echo '</fieldset>' . "\r\n";
76
 
77
+ echo '<fieldset>' . "\r\n";
78
+ echo '<legend>' . esc_html__( 'Color Scheme', 'subscribe2' ) . '</legend>' . "\r\n";
79
+ echo '<label>' . "\r\n";
80
+ echo '<input type="text" name="' . esc_attr( $this->get_field_name( 's2w_bg' ) ) . '" id="' . esc_attr( $this->get_field_id( 's2w_bg' ) ) . '" maxlength="6" value="' . esc_attr( $s2w_bg ) . '" class="colorpickerField" style="width:60px;" /> ' . esc_html__( 'Body', 'subscribe2' ) . '</label><br />' . "\r\n";
81
+ echo '<label>' . "\r\n";
82
+ echo '<input type="text" name="' . esc_attr( $this->get_field_name( 's2w_fg' ) ) . '" id="' . esc_attr( $this->get_field_id( 's2w_fg' ) ) . '" maxlength="6" value="' . esc_attr( $s2w_fg ) . '" class="colorpickerField" style="width:60px;" /> ' . esc_html__( 'Text', 'subscribe2' ) . '</label><br />' . "\r\n";
83
+ echo '<div class="s2_colorpicker" id ="' . esc_attr( $this->get_field_id( 's2_colorpicker' ) ) . '"></div>';
84
+ echo '</fieldset>';
85
 
86
+ echo '<fieldset>' . "\r\n";
87
+ echo '<legend>' . esc_html__( 'Width, Height and Font Size', 'subscribe2' ) . '</legend>' . "\r\n";
88
+ echo '<table style="border:0; padding:0; margin:0 0 12px 0; border-collapse:collapse;" align="center">' . "\r\n";
89
+ echo '<tr><td><label for="' . esc_attr( $this->get_field_id( 's2w_width' ) ) . '">' . esc_html__( 'Width', 'subscribe2' ) . '</label></td>' . "\r\n";
90
+ echo '<td><input type="text" name="' . esc_attr( $this->get_field_name( 's2w_width' ) ) . '" id="' . esc_attr( $this->get_field_id( 's2w_width' ) ) . '" value="' . esc_attr( $s2w_width ) . '" /></td></tr>' . "\r\n";
91
+ echo '<tr><td><label for="' . esc_attr( $this->get_field_id( 's2w_height' ) ) . '">' . esc_html__( 'Height', 'subscribe2' ) . '</label></td>' . "\r\n";
92
+ echo '<td><input type="text" name="' . esc_attr( $this->get_field_name( 's2w_height' ) ) . '" id="' . esc_attr( $this->get_field_id( 's2w_height' ) ) . '" value="' . esc_attr( $s2w_height ) . '" /></td></tr>' . "\r\n";
93
+ echo '<tr><td><label for="' . esc_attr( $this->get_field_id( 's2w_font' ) ) . '">' . esc_html__( 'Font', 'subscribe2' ) . '</label></td>' . "\r\n";
94
+ echo '<td><input type="text" name="' . esc_attr( $this->get_field_name( 's2w_font' ) ) . '" id="' . esc_attr( $this->get_field_id( 's2w_font' ) ) . '" value="' . esc_attr( $s2w_font ) . '" /></td></tr>' . "\r\n";
95
+ echo '</table></fieldset></div>' . "\r\n";
96
  }
97
  }// end S2_Counter_widget class
98
  ?>
include/s2_ajax.js ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global s2_script_strings */
2
+ // Version 1.0 - original version
3
+ // Copyright Matthew Robinson 2015
4
+
5
+ var s2jQuery = jQuery.noConflict();
6
+ s2jQuery( document ).ready( function() {
7
+ var dialog = s2jQuery( '<div></div>' );
8
+ var ajaxurl = s2_script_strings.ajaxurl;
9
+ s2jQuery( 'a.s2popup' ).click( function(){
10
+ var data = {
11
+ 'action': 'subscribe2_form',
12
+ 'data': s2jQuery( 'a.s2popup' ).attr( 'id' )
13
+ };
14
+ jQuery.post( ajaxurl, data, function( response ) {
15
+ dialog.html( response );
16
+ });
17
+ dialog.dialog( { modal: true, zIndex: 10000, title: s2_script_strings.title } );
18
+ dialog.dialog( 'open' );
19
+ });
20
+ s2jQuery( document ).on( 'submit', '#s2ajaxform', function( event ) {
21
+ event.preventDefault();
22
+ var email = s2jQuery( '#s2ajaxform input[name=email]' ).val();
23
+ var ip = s2jQuery( '#s2ajaxform input[name=ip]' ).val();
24
+ var firstname = s2jQuery( '#s2ajaxform input[name=firstname]' ).val();
25
+ if ( typeof firstname === 'undefined' ) {
26
+ firstname = '';
27
+ }
28
+ var lastname = s2jQuery( '#s2ajaxform input[name=lastname]' ).val();
29
+ if ( typeof lastname === 'undefined' ) {
30
+ lastname = '';
31
+ }
32
+ var uri = s2jQuery( '#s2ajaxform input[name=uri]' ).val();
33
+ if ( typeof uri === 'undefined' ) {
34
+ uri = 'http://';
35
+ }
36
+ var btn = s2jQuery( this ).find( 'input[type=submit][clicked=true]' );
37
+ if ( btn.length && s2jQuery( '#s2ajaxform' ).has( btn ) ) {
38
+ var data = {
39
+ 'action': 'subscribe2_submit',
40
+ 'data': {
41
+ email: email,
42
+ ip: ip,
43
+ firstname: firstname,
44
+ lastname: lastname,
45
+ uri: uri,
46
+ button: btn.attr( 'name' )
47
+ }
48
+ };
49
+ jQuery.post( ajaxurl, data, function( response ) {
50
+ dialog.html( response );
51
+ });
52
+ }
53
+ });
54
+ // Allows detection of which button was clicked
55
+ s2jQuery( document ).on( 'click', '#s2ajaxform input[type=submit]', function() {
56
+ s2jQuery( '#s2ajaxform input[type=submit]' ).removeAttr( 'clicked' );
57
+ s2jQuery( this ).attr( 'clicked', 'true' );
58
+ });
59
+ // when form is closed return to default
60
+ s2jQuery( document ).on( 'dialogclose', function() {
61
+ var data = {
62
+ 'action': 'subscribe2_form',
63
+ 'data': s2jQuery( 'a.s2popup' ).attr( 'id' )
64
+ };
65
+ jQuery.post( ajaxurl, data, function( response ) {
66
+ dialog.html( response );
67
+ });
68
+ });
69
+ });
include/s2_ajax.min.js ADDED
@@ -0,0 +1 @@
 
1
+ var s2jQuery=jQuery.noConflict();s2jQuery(document).ready(function(){var dialog=s2jQuery('<div></div>');var ajaxurl=s2_script_strings.ajaxurl;s2jQuery('a.s2popup').click(function(){var data={'action':'subscribe2_form','data':s2jQuery('a.s2popup').attr('id')};jQuery.post(ajaxurl,data,function(response){dialog.html(response)});dialog.dialog({modal:true,zIndex:10000,title:s2_script_strings.title});dialog.dialog('open')});s2jQuery(document).on('submit','#s2ajaxform',function(event){event.preventDefault();var email=s2jQuery('#s2ajaxform input[name=email]').val();var ip=s2jQuery('#s2ajaxform input[name=ip]').val();var firstname=s2jQuery('#s2ajaxform input[name=firstname]').val();if(typeof firstname==='undefined'){firstname=''}var lastname=s2jQuery('#s2ajaxform input[name=lastname]').val();if(typeof lastname==='undefined'){lastname=''}var uri=s2jQuery('#s2ajaxform input[name=uri]').val();if(typeof uri==='undefined'){uri='http://'}var btn=s2jQuery(this).find('input[type=submit][clicked=true]');if(btn.length&&s2jQuery('#s2ajaxform').has(btn)){var data={'action':'subscribe2_submit','data':{email:email,ip:ip,firstname:firstname,lastname:lastname,uri:uri,button:btn.attr('name')}};jQuery.post(ajaxurl,data,function(response){dialog.html(response)})}});s2jQuery(document).on('click','#s2ajaxform input[type=submit]',function(){s2jQuery('#s2ajaxform input[type=submit]').removeAttr('clicked');s2jQuery(this).attr('clicked','true')});s2jQuery(document).on('dialogclose',function(){var data={'action':'subscribe2_form','data':s2jQuery('a.s2popup').attr('id')};jQuery.post(ajaxurl,data,function(response){dialog.html(response)})})});
include/widget.php CHANGED
@@ -3,80 +3,80 @@ class S2_Form_widget extends WP_Widget {
3
  /**
4
  Declares the Subscribe2 widget class.
5
  */
6
- function S2_Form_widget() {
7
- $widget_ops = array('classname' => 's2_form_widget', 'description' => __('Sidebar Widget for Subscribe2', 'subscribe2') );
8
- $control_ops = array('width' => 250, 'height' => 300);
9
- $this->WP_Widget('s2_form_widget', __('Subscribe2 Widget', 'subscribe2'), $widget_ops, $control_ops);
10
  }
11
 
12
  /**
13
  Displays the Widget
14
  */
15
- function widget($args, $instance) {
16
- $title = empty($instance['title']) ? __('Subscribe2', 'subscribe2') : $instance['title'];
17
- $div = empty($instance['div']) ? 'search' : $instance['div'];
18
- $widgetprecontent = empty($instance['widgetprecontent']) ? '' : $instance['widgetprecontent'];
19
- $widgetpostcontent = empty($instance['widgetpostcontent']) ? '' : $instance['widgetpostcontent'];
20
- $textbox_size = empty($instance['size']) ? 20 : $instance['size'];
21
- $hidebutton = empty($instance['hidebutton']) ? 'none' : $instance['hidebutton'];
22
- $postto = empty($instance['postto']) ? '' : $instance['postto'];
23
- $js = empty($instance['js']) ? '' : $instance['js'];
24
- $noantispam = empty($instance['noantispam']) ? '' : $instance['noantispam'];
25
- $nowrap = empty($instance['nowrap']) ? '' : $instance['nowrap'];
26
  $hide = '';
27
- if ( $hidebutton == 'subscribe' || $hidebutton == 'unsubscribe' ) {
28
- $hide = " hide=\"" . $hidebutton . "\"";
29
- } elseif ( $hidebutton == 'link' ) {
30
- $hide = " link=\"" . __('(Un)Subscribe to Posts', 'subscribe2') . "\"";
31
  }
32
  $postid = '';
33
- if ( !empty($postto) ) {
34
- $postid = " id=\"" . $postto . "\"";
35
  }
36
- $size = " size=\"" . $textbox_size . "\"";
37
  $nojs = '';
38
  if ( $js ) {
39
- $nojs = " nojs=\"true\"";
40
  }
41
  if ( $noantispam ) {
42
- $noantispam = " noantispam=\"true\"";
43
  }
44
  if ( $nowrap ) {
45
- $nowrap = " wrap=\"false\"";
46
  }
47
- $shortcode = "[subscribe2" . $hide . $postid . $size . $nojs . $noantispam . $nowrap . "]";
48
  echo $args['before_widget'];
49
- if ( !empty($title) ) {
50
- echo $args['before_title'] . $title . $args['after_title'];
51
  }
52
- echo "<div class=\"" . $div . "\">";
53
  $content = do_shortcode( $shortcode );
54
- if ( !empty($widgetprecontent) ) {
55
- echo $widgetprecontent;
56
  }
57
  echo $content;
58
- if ( !empty($widgetpostcontent) ) {
59
- echo $widgetpostcontent;
60
  }
61
- echo "</div>";
62
  echo $args['after_widget'];
63
  }
64
 
65
  /**
66
  Saves the widgets settings.
67
  */
68
- function update($new_instance, $old_instance) {
69
  $instance = $old_instance;
70
- $instance['title'] = strip_tags(stripslashes($new_instance['title']));
71
- $instance['div'] = strip_tags(stripslashes($new_instance['div']));
72
- $instance['widgetprecontent'] = stripslashes($new_instance['widgetprecontent']);
73
- $instance['widgetpostcontent'] = stripslashes($new_instance['widgetpostcontent']);
74
- $instance['size'] = intval(stripslashes($new_instance['size']));
75
- $instance['hidebutton'] = strip_tags(stripslashes($new_instance['hidebutton']));
76
- $instance['postto'] = stripslashes($new_instance['postto']);
77
- $instance['js'] = stripslashes($new_instance['js']);
78
- $instance['noantispam'] = stripslashes($new_instance['noantispam']);
79
- $instance['nowrap'] = stripslashes($new_instance['nowrap']);
80
 
81
  return $instance;
82
  }
@@ -84,72 +84,72 @@ class S2_Form_widget extends WP_Widget {
84
  /**
85
  Creates the edit form for the widget.
86
  */
87
- function form($instance) {
88
  // set some defaults, getting any old options first
89
- $options = get_option('widget_subscribe2widget');
90
- if ( $options === false ) {
91
- $defaults = array('title' => 'Subscribe2', 'div' => 'search', 'widgetprecontent' => '', 'widgetpostcontent' => '', 'size' => 20, 'hidebutton' => 'none', 'postto' => '', 'js' => '', 'noantispam' => '', 'nowrap' => '');
92
  } else {
93
- $defaults = array('title' => $options['title'], 'div' => $options['div'], 'widgetprecontent' => $options['widgetprecontent'], 'widgetpostcontent' => $options['widgetpostcontent'], 'size' => $options['size'], 'hidebutton' => $options['hidebutton'], 'postto' => $options['postto'], 'js' => $options['js'], 'noantispam' => $options['noantispam'], 'nowrap' => $options['nowrap']);
94
- delete_option('widget_subscribe2widget');
95
  }
96
  // code to obtain old settings too
97
- $instance = wp_parse_args( (array) $instance, $defaults);
98
 
99
- $title = htmlspecialchars($instance['title'], ENT_QUOTES);
100
- $div = htmlspecialchars($instance['div'], ENT_QUOTES);
101
- $widgetprecontent = htmlspecialchars($instance['widgetprecontent'], ENT_QUOTES);
102
- $widgetpostcontent = htmlspecialchars($instance['widgetpostcontent'], ENT_QUOTES);
103
- $size = htmlspecialchars($instance['size'], ENT_QUOTES);
104
- $hidebutton = htmlspecialchars($instance['hidebutton'], ENT_QUOTES);
105
- $postto = htmlspecialchars($instance['postto'], ENT_QUOTES);
106
- $js = htmlspecialchars($instance['js'], ENT_QUOTES);
107
- $noantispam = htmlspecialchars($instance['noantispam'], ENT_QUOTES);
108
- $nowrap = htmlspecialchars($instance['nowrap'], ENT_QUOTES);
109
 
110
  global $wpdb, $mysubscribe2;
111
  $sql = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type='page' AND post_status='publish'";
112
 
113
- echo "<div>\r\n";
114
- echo "<p><label for=\"" . $this->get_field_id('title') . "\">" . __('Title', 'subscribe2') . ":\r\n";
115
- echo "<input class=\"widefat\" id=\"" . $this->get_field_id('title') . "\" name=\"" . $this->get_field_name('title') . "\" type=\"text\" value=\"" . $title . "\" /></label></p>\r\n";
116
- echo "<p><label for=\"" . $this->get_field_id('div') . "\">" . __('Div class name', 'subscribe2') . ":\r\n";
117
- echo "<input class=\"widefat\" id=\"" . $this->get_field_id('div') . "\" name=\"" . $this->get_field_name('div') . "\" type=\"text\" value=\"" . $div . "\" /></label></p>\r\n";
118
- echo "<p><label for=\"" . $this->get_field_id('widgetprecontent') . "\">" . __('Pre-Content', 'subscribe2') . ":\r\n";
119
- echo "<textarea class=\"widefat\" id=\"" . $this->get_field_id('widgetprecontent') . "\" name=\"" . $this->get_field_name('widgetprecontent') . "\" rows=\"2\" cols=\"25\">" . $widgetprecontent . "</textarea></label></p>\r\n";
120
- echo "<p><label for=\"" . $this->get_field_id('widgetpostcontent') . "\">" . __('Post-Content', 'subscribe2') . ":\r\n";
121
- echo "<textarea class=\"widefat\" id=\"" . $this->get_field_id('widgetpostcontent') . "\" name=\"" . $this->get_field_name('widgetpostcontent') . "\" rows=\"2\" cols=\"25\">" . $widgetpostcontent . "</textarea></label></p>\r\n";
122
- echo "<p><label for=\"" . $this->get_field_id('size') . "\">" . __('Text Box Size', 'subscribe2') . ":\r\n";
123
- echo "<input class=\"widefat\" id=\"" . $this->get_field_id('size') . "\" name=\"" . $this->get_field_name('size') . "\" type=\"text\" value=\"" . $size . "\" /></label></p>\r\n";
124
- echo "<p>" . __('Display options', 'subscribe2') . ":<br />\r\n";
125
- echo "<label for=\"" . $this->get_field_id('hidebutton') . "complete\"><input id=\"" . $this->get_field_id('hidebutton') . "complete\" name=\"" . $this->get_field_name('hidebutton') . "\" type=\"radio\" value=\"none\"". checked('none', $hidebutton, false) . "/> " . __('Show complete form', 'subscribe2') . "</label>\r\n";
126
- echo "<br /><label for=\"" . $this->get_field_id('hidebutton') . "subscribe\"><input id=\"" . $this->get_field_id('hidebutton') . "subscribe\" name=\"" . $this->get_field_name('hidebutton') . "\" type=\"radio\" value=\"subscribe\"". checked('subscribe', $hidebutton, false) . "/> " . __('Hide Subscribe button', 'subscribe2') . "</label>\r\n";
127
- echo "<br /><label for=\"" . $this->get_field_id('hidebutton') . "unsubscribe\"><input id=\"" . $this->get_field_id('hidebutton') . "unsubscribe\" name=\"" . $this->get_field_name('hidebutton') . "\" type=\"radio\" value=\"unsubscribe\"". checked('unsubscribe', $hidebutton, false) . "/> " . __('Hide Unsubscribe button', 'subscribe2') . "</label>\r\n";
128
- if ( '1' == $mysubscribe2->subscribe2_options['ajax'] ) {
129
- echo "<br /><label for=\"" . $this->get_field_id('hidebutton') . "ajax\"><input id=\"" . $this->get_field_id('hidebutton') . "ajax\" name=\"" . $this->get_field_name('hidebutton') . "\" type=\"radio\" value=\"link\"". checked('link', $hidebutton, false) . "/> " . __('Show as link', 'subscribe2') . "</label>\r\n";
130
  }
131
- echo "</p>\r\n";
132
- echo "<p><label for=\"" . $this->get_field_id('postto') . "\">" . __('Post form content to page', 'subscribe2') . ":\r\n";
133
- echo "<select class=\"widefat\" id=\"" . $this->get_field_id('postto') . "\" name=\"" . $this->get_field_name('postto') . "\">\r\n";
134
- echo "<option value=\"" . $mysubscribe2->subscribe2_options['s2page'] . "\">" . __('Use Subscribe2 Default', 'subscribe2') . "</option>\r\n";
135
- echo "<option value=\"home\"";
136
- if ( $postto === 'home' ) { echo " selected=\"selected\""; }
137
- echo ">" . __('Use Home Page', 'subscribe2') . "</option>\r\n";
138
- echo "<option value=\"self\"";
139
- if ( $postto === 'self' ) { echo " selected=\"selected\""; }
140
- echo ">" . __('Use Referring Page', 'subscribe2') . "</option>\r\n";
141
- $mysubscribe2->pages_dropdown($postto);
142
- echo "</select></label></p>\r\n";
143
- echo "<p><label for=\"" . $this->get_field_id('js') . "\">" . __('Disable JavaScript', 'subscribe2') . ":\r\n";
144
- echo "<input id=\"" . $this->get_field_id('js') . "\" name =\"" . $this->get_field_name('js') . "\" value=\"true\" type=\"checkbox\"" . checked('true', $js, false) . "/>";
145
- echo "</label></p>\r\n";
146
- echo "<p><label for=\"" . $this->get_field_id('noantispam') . "\">" . __('Disable Anti-spam measures', 'subscribe2') . ":\r\n";
147
- echo "<input id=\"" . $this->get_field_id('noantispam') . "\" name =\"" . $this->get_field_name('noantispam') . "\" value=\"true\" type=\"checkbox\"" . checked('true', $noantispam, false) . "/>";
148
- echo "</label></p>\r\n";
149
- echo "<p><label for=\"" . $this->get_field_id('nowrap') . "\">" . __('Disable wrapping of form buttons', 'subscribe2') . ":\r\n";
150
- echo "<input id=\"" . $this->get_field_id('nowrap') . "\" name =\"" . $this->get_field_name('nowrap') . "\" value=\"true\" type=\"checkbox\"" . checked('true', $nowrap, false) . "/>";
151
- echo "</label></p>\r\n";
152
- echo "</div>\r\n";
153
  }
154
  } // End S2_Form_widget class
155
  ?>
3
  /**
4
  Declares the Subscribe2 widget class.
5
  */
6
+ function __construct() {
7
+ $widget_ops = array( 'classname' => 's2_form_widget', 'description' => esc_html__( 'Sidebar Widget for Subscribe2', 'subscribe2' ) );
8
+ $control_ops = array( 'width' => 250, 'height' => 300 );
9
+ parent::__construct( 's2_form_widget', esc_html__( 'Subscribe2 Widget', 'subscribe2' ), $widget_ops, $control_ops );
10
  }
11
 
12
  /**
13
  Displays the Widget
14
  */
15
+ function widget( $args, $instance ) {
16
+ $title = empty( $instance['title'] ) ? __( 'Subscribe2', 'subscribe2' ) : $instance['title'];
17
+ $div = empty( $instance['div'] ) ? 'search' : $instance['div'];
18
+ $widgetprecontent = empty( $instance['widgetprecontent'] ) ? '' : $instance['widgetprecontent'];
19
+ $widgetpostcontent = empty( $instance['widgetpostcontent'] ) ? '' : $instance['widgetpostcontent'];
20
+ $textbox_size = empty( $instance['size'] ) ? 20 : $instance['size'];
21
+ $hidebutton = empty( $instance['hidebutton'] ) ? 'none' : $instance['hidebutton'];
22
+ $postto = empty( $instance['postto'] ) ? '' : $instance['postto'];
23
+ $js = empty( $instance['js'] ) ? '' : $instance['js'];
24
+ $noantispam = empty( $instance['noantispam'] ) ? '' : $instance['noantispam'];
25
+ $nowrap = empty( $instance['nowrap'] ) ? '' : $instance['nowrap'];
26
  $hide = '';
27
+ if ( 'subscribe' === $hidebutton || 'unsubscribe' === $hidebutton ) {
28
+ $hide = ' hide="' . $hidebutton . '"';
29
+ } elseif ( 'link' === $hidebutton ) {
30
+ $hide = ' link="' . __( '(Un)Subscribe to Posts', 'subscribe2' ) . '"';
31
  }
32
  $postid = '';
33
+ if ( ! empty( $postto ) ) {
34
+ $postid = ' id="' . $postto . '"';
35
  }
36
+ $size = ' size="' . $textbox_size . '"';
37
  $nojs = '';
38
  if ( $js ) {
39
+ $nojs = ' nojs="true"';
40
  }
41
  if ( $noantispam ) {
42
+ $noantispam = ' noantispam="true"';
43
  }
44
  if ( $nowrap ) {
45
+ $nowrap = ' wrap="false"';
46
  }
47
+ $shortcode = '[subscribe2' . $hide . $postid . $size . $nojs . $noantispam . $nowrap . ']';
48
  echo $args['before_widget'];
49
+ if ( ! empty( $title ) ) {
50
+ echo $args['before_title'] . esc_attr( $title ) . $args['after_title'];
51
  }
52
+ echo '<div class="' . esc_attr( $div ) . '">';
53
  $content = do_shortcode( $shortcode );
54
+ if ( ! empty( $widgetprecontent ) ) {
55
+ echo wp_kses( $widgetprecontent, 'post' );
56
  }
57
  echo $content;
58
+ if ( ! empty( $widgetpostcontent ) ) {
59
+ echo wp_kses( $widgetpostcontent, 'post' );
60
  }
61
+ echo '</div>';
62
  echo $args['after_widget'];
63
  }
64
 
65
  /**
66
  Saves the widgets settings.
67
  */
68
+ function update( $new_instance, $old_instance ) {
69
  $instance = $old_instance;
70
+ $instance['title'] = strip_tags( stripslashes( $new_instance['title'] ) );
71
+ $instance['div'] = strip_tags( stripslashes( $new_instance['div'] ) );
72
+ $instance['widgetprecontent'] = stripslashes( $new_instance['widgetprecontent'] );
73
+ $instance['widgetpostcontent'] = stripslashes( $new_instance['widgetpostcontent'] );
74
+ $instance['size'] = intval( stripslashes( $new_instance['size'] ) );
75
+ $instance['hidebutton'] = strip_tags( stripslashes( $new_instance['hidebutton'] ) );
76
+ $instance['postto'] = stripslashes( $new_instance['postto'] );
77
+ $instance['js'] = stripslashes( $new_instance['js'] );
78
+ $instance['noantispam'] = stripslashes( $new_instance['noantispam'] );
79
+ $instance['nowrap'] = stripslashes( $new_instance['nowrap'] );
80
 
81
  return $instance;
82
  }
84
  /**
85
  Creates the edit form for the widget.
86
  */
87
+ function form( $instance ) {
88
  // set some defaults, getting any old options first
89
+ $options = get_option( 'widget_subscribe2widget' );
90
+ if ( false === $options ) {
91
+ $defaults = array( 'title' => 'Subscribe2', 'div' => 'search', 'widgetprecontent' => '', 'widgetpostcontent' => '', 'size' => 20, 'hidebutton' => 'none', 'postto' => '', 'js' => '', 'noantispam' => '', 'nowrap' => '' );
92
  } else {
93
+ $defaults = array( 'title' => $options['title'], 'div' => $options['div'], 'widgetprecontent' => $options['widgetprecontent'], 'widgetpostcontent' => $options['widgetpostcontent'], 'size' => $options['size'], 'hidebutton' => $options['hidebutton'], 'postto' => $options['postto'], 'js' => $options['js'], 'noantispam' => $options['noantispam'], 'nowrap' => $options['nowrap'] );
94
+ delete_option( 'widget_subscribe2widget' );
95
  }
96
  // code to obtain old settings too
97
+ $instance = wp_parse_args( (array) $instance, $defaults );
98
 
99
+ $title = htmlspecialchars( $instance['title'], ENT_QUOTES );
100
+ $div = htmlspecialchars( $instance['div'], ENT_QUOTES );
101
+ $widgetprecontent = htmlspecialchars( $instance['widgetprecontent'], ENT_QUOTES );
102
+ $widgetpostcontent = htmlspecialchars( $instance['widgetpostcontent'], ENT_QUOTES );
103
+ $size = htmlspecialchars( $instance['size'], ENT_QUOTES );
104
+ $hidebutton = htmlspecialchars( $instance['hidebutton'], ENT_QUOTES );
105
+ $postto = htmlspecialchars( $instance['postto'], ENT_QUOTES );
106
+ $js = htmlspecialchars( $instance['js'], ENT_QUOTES );
107
+ $noantispam = htmlspecialchars( $instance['noantispam'], ENT_QUOTES );
108
+ $nowrap = htmlspecialchars( $instance['nowrap'], ENT_QUOTES );
109
 
110
  global $wpdb, $mysubscribe2;
111
  $sql = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type='page' AND post_status='publish'";
112
 
113
+ echo '<div>' . "\r\n";
114
+ echo '<p><label for="'. esc_attr( $this->get_field_id( 'title' ) ) . '">' . __( 'Title', 'subscribe2' ) . ':' . "\r\n";
115
+ echo '<input class="widefat" id="' . esc_attr( $this->get_field_id( 'title' ) ) . '" name="' . esc_attr( $this->get_field_name( 'title' ) ) . '" type="text" value="' . esc_html__( $title ) . '" /></label></p>' . "\r\n";
116
+ echo '<p><label for="' . esc_attr( $this->get_field_id( 'div' ) ) . '">' . __( 'Div class name', 'subscribe2' ) . ':' . "\r\n";
117
+ echo '<input class="widefat" id="' . esc_attr( $this->get_field_id( 'div' ) ) . '" name="' . esc_attr( $this->get_field_name( 'div' ) ) . '" type="text" value="' . esc_html__( $div ) . '" /></label></p>' . "\r\n";
118
+ echo '<p><label for="' . esc_attr( $this->get_field_id( 'widgetprecontent' ) ) . '">' . esc_html__( 'Pre-Content', 'subscribe2' ) . ':' . "\r\n";
119
+ echo '<textarea class="widefat" id="' . esc_attr( $this->get_field_id( 'widgetprecontent' ) ) . '" name="' . esc_attr( $this->get_field_name( 'widgetprecontent' ) ) . '" rows="2" cols="25">' . esc_html__( $widgetprecontent ) . '</textarea></label></p>' . "\r\n";
120
+ echo '<p><label for="' . esc_attr( $this->get_field_id( 'widgetpostcontent' ) ) . '">' . __( 'Post-Content', 'subscribe2' ) . ':' . "\r\n";
121
+ echo '<textarea class="widefat" id="' . esc_attr( $this->get_field_id( 'widgetpostcontent' ) ) . '" name="' . esc_attr( $this->get_field_name( 'widgetpostcontent' ) ) . '" rows="2" cols="25">' . esc_html__( $widgetpostcontent ) . '</textarea></label></p>' . "\r\n";
122
+ echo '<p><label for="' . esc_attr( $this->get_field_id( 'size' ) ) . '">' . esc_html__( 'Text Box Size', 'subscribe2' ) . ':' . "\r\n";
123
+ echo '<input class="widefat" id="' . esc_attr( $this->get_field_id( 'size' ) ) . '" name="' . esc_attr( $this->get_field_name( 'size' ) ) . '" type="text" value="' . esc_html__( $size ) . '" /></label></p>' . "\r\n";
124
+ echo '<p>' . __( 'Display options', 'subscribe2' ) . ':<br />' . "\r\n";
125
+ echo '<label for="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'complete"><input id="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'complete" name="' . esc_attr( $this->get_field_name( 'hidebutton' ) ) . '" type="radio" value="none"'. checked( 'none', $hidebutton, false ) . '/> ' . esc_html__( 'Show complete form', 'subscribe2' ) . '</label>' . "\r\n";
126
+ echo '<br /><label for="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'subscribe"><input id="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'subscribe" name="' . esc_attr( $this->get_field_name( 'hidebutton' ) ) . '" type="radio" value="subscribe"' . checked( 'subscribe', $hidebutton, false ) . '/> ' . esc_html__( 'Hide Subscribe button', 'subscribe2' ) . '</label>' . "\r\n";
127
+ echo '<br /><label for="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'unsubscribe"><input id="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'unsubscribe" name="' . esc_attr( $this->get_field_name( 'hidebutton' ) ) . '" type="radio" value="unsubscribe"'. checked( 'unsubscribe', $hidebutton, false ) . '/> ' . esc_html__( 'Hide Unsubscribe button', 'subscribe2' ) . '</label>' . "\r\n";
128
+ if ( '1' === $mysubscribe2->subscribe2_options['ajax'] ) {
129
+ echo '<br /><label for="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'ajax"><input id="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'ajax" name="' . esc_attr( $this->get_field_name( 'hidebutton' ) ) . '" type="radio" value="link"'. checked( 'link', $hidebutton, false ) . '/> ' . esc_html__( 'Show as link', 'subscribe2' ) . '</label>' . "\r\n";
130
  }
131
+ echo '</p>' . "\r\n";
132
+ echo '<p><label for="' . esc_attr( $this->get_field_id( 'postto' ) ) . '">' . esc_html__( 'Post form content to page', 'subscribe2' ) . ':' . "\r\n";
133
+ echo '<select class="widefat" id="' . esc_attr( $this->get_field_id( 'postto' ) ) . '" name="' . esc_attr( $this->get_field_name( 'postto' ) ) . '">' . "\r\n";
134
+ echo '<option value="' . esc_attr( $mysubscribe2->subscribe2_options['s2page'] ) . '">' . esc_html__( 'Use Subscribe2 Default', 'subscribe2' ) . '</option>' . "\r\n";
135
+ echo '<option value="home"';
136
+ if ( 'home' === $postto ) { echo ' selected="selected"'; }
137
+ echo '>' . esc_html__( 'Use Home Page', 'subscribe2' ) . '</option>' . "\r\n";
138
+ echo '<option value="self"';
139
+ if ( 'self' === $postto ) { echo ' selected="selected"'; }
140
+ echo '>' . esc_html__( 'Use Referring Page', 'subscribe2' ) . '</option>' . "\r\n";
141
+ $mysubscribe2->pages_dropdown( $postto );
142
+ echo '</select></label></p>' . "\r\n";
143
+ echo '<p><label for="' . esc_attr( $this->get_field_id( 'js' ) ) . '">' . esc_html__( 'Disable JavaScript', 'subscribe2' ) . ':' . "\r\n";
144
+ echo '<input id="' . esc_attr( $this->get_field_id( 'js' ) ) . '" name ="' . esc_attr( $this->get_field_name( 'js' ) ) . '" value="true" type="checkbox"' . checked( 'true', $js, false ) . '/>';
145
+ echo '</label></p>' . "\r\n";
146
+ echo '<p><label for="' . esc_attr( $this->get_field_id( 'noantispam' ) ) . '">' . esc_html__( 'Disable Anti-spam measures', 'subscribe2' ) . ':' . "\r\n";
147
+ echo '<input id="' . esc_attr( $this->get_field_id( 'noantispam' ) ) . '" name ="' . esc_attr( $this->get_field_name( 'noantispam' ) ) . '" value="true" type="checkbox"' . checked( 'true', $noantispam, false ) . '/>';
148
+ echo '</label></p>' . "\r\n";
149
+ echo '<p><label for="' . esc_attr( $this->get_field_id( 'nowrap' ) ) . '">' . esc_html__( 'Disable wrapping of form buttons', 'subscribe2' ) . ':' . "\r\n";
150
+ echo '<input id="' . esc_attr( $this->get_field_id( 'nowrap' ) ) . '" name ="' . esc_attr( $this->get_field_name( 'nowrap' ) ) . '" value="true" type="checkbox"' . checked( 'true', $nowrap, false ) . '/>';
151
+ echo '</label></p>' . "\r\n";
152
+ echo '</div>' . "\r\n";
153
  }
154
  } // End S2_Form_widget class
155
  ?>
readygraph-extension.php CHANGED
@@ -1,17 +1,20 @@
1
  <?php
 
2
  // Extension Configuration
3
- //
4
- $plugin_slug = basename(dirname(__FILE__));
5
- $menu_slug = 'readygraph-app';
6
- $main_plugin_title = 'Subscribe2';
7
- //wp_enqueue_script( 'my-ajax-request', plugin_dir_url( __FILE__ ) . 'assets/js/admin.js', array( 'jquery' ) );
8
- //wp_localize_script( 'my-ajax-request', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
9
  add_action( 'wp_ajax_nopriv_s2-myajax-submit', 's2_myajax_submit' );
10
  add_action( 'wp_ajax_s2-myajax-submit', 's2_myajax_submit' );
11
 
12
  function s2_myajax_submit() {
13
- global $wpdb;
 
 
14
  $email = $_POST['email'];
 
 
15
  if (class_exists('s2class')){
16
  $s2class_instance = new s2class();
17
  $s2class_instance->ip = $_SERVER['REMOTE_ADDR'];
@@ -19,153 +22,129 @@ function s2_myajax_submit() {
19
  $s2class_instance->add( $email );
20
  }
21
  wp_die();
22
-
23
  }
24
 
25
- // ReadyGraph Engine Hooker
26
- //
27
- include_once('extension/readygraph/extension.php');
28
- /*
29
- function add_readygraph_admin_menu_option()
30
- {
31
- global $plugin_slug, $menu_slug;
32
- append_submenu_page($plugin_slug, 'Readygraph App', __( 'Readygraph App', $plugin_slug), 'administrator', $menu_slug, 'add_readygraph_page');
33
- }
34
-
35
- function add_readygraph_page() {
36
- include_once('extension/readygraph/admin.php');
37
- }
38
- */
39
- function on_plugin_activated_readygraph_s2_redirect(){
40
-
41
- global $menu_slug;
42
- $setting_url="admin.php?page=$menu_slug";
43
- if (get_option('rg_s2_plugin_do_activation_redirect', false)) {
44
- delete_option('rg_s2_plugin_do_activation_redirect');
45
- wp_redirect(admin_url($setting_url));
46
- }
47
- }
48
-
49
- // remove_action('admin_init', 'on_plugin_activated_redirect');
50
-
51
- // add_action('admin_menu', 'add_readygraph_admin_menu_option');
52
- add_action('admin_notices', 'add_readygraph_plugin_warning');
53
- add_action('wp_footer', 'readygraph_client_script_head');
54
- add_action('admin_init', 'on_plugin_activated_readygraph_s2_redirect');
55
- add_option('readygraph_connect_notice','true');
56
- /*
57
- add_filter( 'cron_schedules', 'readygraph_s2_cron_intervals' );
58
-
59
- //add_action( 'wp_ajax_add', 'add' );
60
- function readygraph_s2_cron_intervals( $schedules ) {
61
- $schedules['weekly'] = array( // Provide the programmatic name to be used in code
62
- 'interval' => 604800, // Intervals are listed in seconds
63
- 'display' => __('Every Week') // Easy to read display name
64
- );
65
- return $schedules; // Do not forget to give back the list of schedules!
66
- }
67
 
 
68
 
69
- add_action( 'rg_s2_cron_hook', 'rg_s2_cron_exec' );
70
- $send_blog_updates = get_option('readygraph_send_blog_updates');
71
- if ($send_blog_updates == 'true'){
72
- if( !wp_next_scheduled( 'rg_s2_cron_hook' )) {
73
- wp_schedule_event( time(), 'weekly', 'rg_s2_cron_hook' );
74
- }
 
75
  }
76
- else
77
- {
78
- //do nothing
79
- }
80
- if ($send_blog_updates == 'false'){
81
- wp_clear_scheduled_hook( 'rg_s2_cron_hook' );
82
- }
83
- function rg_s2_cron_exec() {
84
- // $send_blog_updates = get_option('readygraph_send_blog_updates');
85
- $readygraph_email = get_option('readygraph_email', '');
86
- // wp_mail($readygraph_email, 'Automatic email', 'Hello, this is an automatically scheduled email from WordPress.');
87
- global $wpdb;
88
- $query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' and post_modified between date_sub(now(),INTERVAL 1 WEEK) and now() ORDER BY post_modified DESC LIMIT 5";
89
-
90
- global $wpdb;
91
- $recentposts = $wpdb->get_results($query);
92
-
93
- echo "<h2> Recently Updated</h2>";
94
- echo "<ul>";
95
- $postdata = "";
96
- $postdatalinks = "";
97
- $postexcerpts = "";
98
- foreach($recentposts as $post) {
99
- $post_content = get_posts($post->ID);
100
- $postdata .= $post->post_title . ", ";
101
- $postdatalinks .= get_permalink($post->ID) . ", ";
102
- $postexcerpts .= wp_trim_words( $post_content->post_content ) . ", ";
103
- }
104
- $url = 'http://readygraph.com/api/v1/post.json/';
105
- $response = wp_remote_post($url, array( 'body' => array('is_wordpress'=>1, 'message' => rtrim($postdata, ", "), 'message_link' => rtrim($postdatalinks, ", "), 'message_excerpt' => rtrim($postexcerpts, ", "),'client_key' => get_option('readygraph_application_id'), 'email' => get_option('readygraph_email'))));
106
 
107
- if ( is_wp_error( $response ) ) {
108
- $error_message = $response->get_error_message();
109
- //echo "Something went wrong: $error_message";
110
- } else {
111
- //echo 'Response:<pre>';
112
- //print_r( $response );
113
- //echo '</pre>';
114
- }
115
- echo "</ul>";
116
-
117
- //endif
118
- }
119
-
120
-
121
- add_action( 'rg_s2_daily_cron_hook', 'rg_s2_daily_cron_exec' );
122
- $send_daily_digest = get_option('readygraph_send_daily_digest');
123
- if ($send_daily_digest == 'true'){
124
- if( !wp_next_scheduled( 'rg_s2_daily_cron_hook' )) {
125
- wp_schedule_event( time(), 'daily', 'rg_s2_daily_cron_hook' );
126
- }
127
- }
128
- else
129
- {
130
- //do nothing
131
- }
132
- if ($send_daily_digest == 'false'){
133
- wp_clear_scheduled_hook( 'rg_s2_daily_cron_hook' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  }
135
- function rg_s2_daily_cron_exec() {
136
- global $wpdb;
137
- $query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' and post_modified between date_sub(now(),INTERVAL 1 day) and now() ORDER BY post_modified DESC LIMIT 5";
138
-
139
- global $wpdb;
140
- $recentposts = $wpdb->get_results($query);
141
-
142
- echo "<h2> Recently Updated</h2>";
143
- echo "<ul>";
144
- $postdata = "";
145
- $postdatalinks = "";
146
- $postexcerpts = "";
147
- foreach($recentposts as $post) {
148
- $post_content = get_posts($post->ID);
149
- $postdata .= $post->post_title . ", ";
150
- $postdatalinks .= get_permalink($post->ID) . ", ";
151
- $postexcerpts .= wp_trim_words( $post_content->post_content ) . ", ";
152
- }
153
- $url = 'http://readygraph.com/api/v1/post.json/';
154
- $response = wp_remote_post($url, array( 'body' => array('is_wordpress'=>1, 'message' => rtrim($postdata, ", "), 'message_link' => rtrim($postdatalinks, ", "), 'message_excerpt' => rtrim($postexcerpts, ", "),'client_key' => get_option('readygraph_application_id'), 'email' => get_option('readygraph_email'))));
155
-
156
- if ( is_wp_error( $response ) ) {
157
- $error_message = $response->get_error_message();
158
- //echo "Something went wrong: $error_message";
159
- } else {
160
- //echo 'Response:<pre>';
161
- //print_r( $response );
162
- //echo '</pre>';
163
  }
164
- echo "</ul>";
165
-
166
- //endif
167
  }
168
- */
 
 
169
  function rg_s2_popup_options_enqueue_scripts() {
170
  if ( get_option('readygraph_popup_template') == 'default-template' ) {
171
  wp_enqueue_style( 'default-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/default-popup.css' );
@@ -188,70 +167,81 @@ function rg_s2_popup_options_enqueue_scripts() {
188
  if ( get_option('readygraph_popup_template') == 'yellow-template' ) {
189
  wp_enqueue_style( 'yellow-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/yellow-popup.css' );
190
  }
191
- if ( get_option('readygraph_popup_template') == 'custom-template' ) {
192
- /*echo '<style type="text/css">
193
- .rgw-lightbox .rgw-content-frame .rgw-content {
194
- background: '.get_option("readygraph_popup_template_background").' !important;
195
- }
196
-
197
- .rgw-style{
198
- color: '.get_option("readygraph_popup_template_text").' !important;
199
- }
200
- .rgw-style .rgw-dialog-header .rgw-dialog-headline, .rgw-style .rgw-dialog-header .rgw-dialog-headline * {
201
- color: '.get_option("readygraph_popup_template_text").' !important;
202
- }
203
- .rgw-notify .rgw-float-box {
204
- background: '.get_option("readygraph_popup_template_background").' !important;
205
- }
206
- .rgw-notify .rgw-social-status:hover{
207
- background: '.get_option("readygraph_popup_template_background").' !important;
208
- }</style>';*/
209
  wp_enqueue_style( 'custom-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/custom-popup.css' );
210
  }
211
  }
212
- add_action( 'admin_enqueue_scripts', 'rg_s2_popup_options_enqueue_scripts' );
213
- add_action( 'wp_enqueue_scripts', 'rg_s2_popup_options_enqueue_scripts' );
214
- add_action( 'admin_enqueue_scripts', 'rg_s2_enqueue_color_picker' );
215
-
216
- function rg_s2_enqueue_color_picker( $hook_suffix ) {
217
- // first check that $hook_suffix is appropriate for your admin page
218
- wp_enqueue_style( 'wp-color-picker' );
219
- wp_enqueue_script( 's2-script-handle', plugins_url('/extension/readygraph/assets/js/my-script.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
220
- }
221
 
222
  function s2_post_updated_send_email( $post_id ) {
223
-
224
  // If this is just a revision, don't send the email.
225
- if ( wp_is_post_revision( $post_id ) )
226
- return;
 
227
  if(get_option('readygraph_application_id') && strlen(get_option('readygraph_application_id')) > 0 && get_option('readygraph_send_blog_updates') == "true"){
228
-
229
- $post_title = get_the_title( $post_id );
230
- $post_url = get_permalink( $post_id );
231
- $post_content = get_post($post_id);
232
- if (get_option('readygraph_send_real_time_post_updates')=='true'){
233
- $url = 'http://readygraph.com/api/v1/post.json/';
234
- $response = wp_remote_post($url, array( 'body' => array('is_wordpress'=>1, 'is_realtime'=>1, 'message' => $post_title, 'message_link' => $post_url,'message_excerpt' => wp_trim_words( $post_content->post_content, 100 ),'client_key' => get_option('readygraph_application_id'), 'email' => get_option('readygraph_email'))));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  }
 
 
 
 
 
 
 
236
  else {
237
- $response = wp_remote_post($url, array( 'body' => array('is_wordpress'=>1, 'message' => $post_title, 'message_link' => $post_url,'message_excerpt' => wp_trim_words( $post_content->post_content, 100 ),'client_key' => get_option('readygraph_application_id'), 'email' => get_option('readygraph_email'))));
238
- }
239
- if ( is_wp_error( $response ) ) {
240
- $error_message = $response->get_error_message();
241
- //echo "Something went wrong: $error_message";
242
- } else {
243
- //echo 'Response:<pre>';
244
- //print_r( $response );
245
- //echo '</pre>';
246
  }
247
- $app_id = get_option('readygraph_application_id');
248
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=post_created&app_id=$app_id" );
249
- }
250
- else{
251
- }
252
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  }
254
- add_action( 'publish_post', 's2_post_updated_send_email' );
255
- add_action( 'publish_page', 's2_post_updated_send_email' );
256
 
257
  ?>
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
  // Extension Configuration
4
+ $s2_plugin_slug = basename(dirname(__FILE__));
5
+ $s2_menu_slug = 'readygraph-app';
6
+ $s2_main_plugin_title = 'Subscribe2';
7
+
 
 
8
  add_action( 'wp_ajax_nopriv_s2-myajax-submit', 's2_myajax_submit' );
9
  add_action( 'wp_ajax_s2-myajax-submit', 's2_myajax_submit' );
10
 
11
  function s2_myajax_submit() {
12
+ if ($_POST['adsoptimal_id']) update_option('readygraph_adsoptimal_id',$_POST['adsoptimal_id']);
13
+ if ($_POST['adsoptimal_secret']) update_option('readygraph_adsoptimal_secret',$_POST['adsoptimal_secret']);
14
+ if (isset($_POST['readygraph_monetize'])) update_option('readygraph_enable_monetize',$_POST['readygraph_monetize']);
15
  $email = $_POST['email'];
16
+ if ($email){
17
+ global $wpdb;
18
  if (class_exists('s2class')){
19
  $s2class_instance = new s2class();
20
  $s2class_instance->ip = $_SERVER['REMOTE_ADDR'];
22
  $s2class_instance->add( $email );
23
  }
24
  wp_die();
25
+ }
26
  }
27
 
28
+ // ReadyGraph Engine Hooker
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
+ include_once('extension/readygraph/extension.php');
31
 
32
+ function on_plugin_activated_readygraph_s2_redirect(){
33
+ global $s2_menu_slug;
34
+ $setting_url="admin.php?page=$s2_menu_slug";
35
+ if (get_option('rg_s2_plugin_do_activation_redirect', false)) {
36
+ delete_option('rg_s2_plugin_do_activation_redirect');
37
+ wp_redirect(admin_url($setting_url));
38
+ }
39
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
+ function add_s2_readygraph_plugin_warning() {
42
+ if (get_option('readygraph_access_token', '') != '') return;
43
+ global $hook_suffix, $current_user, $s2_menu_slug;
44
+ if(isset($_GET["readygraph_notice"]) && $_GET["readygraph_notice"] == "dismiss") update_option('readygraph_connect_notice','false');
45
+ if ( $hook_suffix == 'plugins.php' && get_option('readygraph_connect_notice') == 'true' ) {
46
+ echo '<div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
47
+ <style type="text/css">
48
+ .readygraph_activate {
49
+ min-width:825px;
50
+ padding:7px;
51
+ margin:15px 0;
52
+ background:#1b75bb;
53
+ -moz-border-radius:3px;
54
+ border-radius:3px;
55
+ -webkit-border-radius:3px;
56
+ position:relative;
57
+ overflow:hidden;
58
+ }
59
+ .readygraph_activate .aa_button {
60
+ cursor: pointer;
61
+ -moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
62
+ -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
63
+ box-shadow:inset 0px 1px 0px 0px #ffffff;
64
+ background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #f9f9f9), color-stop(1, #e9e9e9) );
65
+ background:-moz-linear-gradient( center top, #f9f9f9 5%, #e9e9e9 100% );
66
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#f9f9f9", endColorstr="#e9e9e9");
67
+ background-color:#f9f9f9;
68
+ -webkit-border-top-left-radius:3px;
69
+ -moz-border-radius-topleft:3px;
70
+ border-top-left-radius:3px;
71
+ -webkit-border-top-right-radius:3px;
72
+ -moz-border-radius-topright:3px;
73
+ border-top-right-radius:3px;
74
+ -webkit-border-bottom-right-radius:3px;
75
+ -moz-border-radius-bottomright:3px;
76
+ border-bottom-right-radius:3px;
77
+ -webkit-border-bottom-left-radius:3px;
78
+ -moz-border-radius-bottomleft:3px;
79
+ border-bottom-left-radius:3px;
80
+ text-indent:0;
81
+ border:1px solid #dcdcdc;
82
+ display:inline-block;
83
+ color:#333333;
84
+ font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
85
+ font-size:15px;
86
+ font-weight:normal;
87
+ font-style:normal;
88
+ height:40px;
89
+ line-height:40px;
90
+ width:275px;
91
+ text-decoration:none;
92
+ text-align:center;
93
+ text-shadow:1px 1px 0px #ffffff;
94
+ }
95
+ .readygraph_activate .aa_button:hover {
96
+ background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #e9e9e9), color-stop(1, #f9f9f9) );
97
+ background:-moz-linear-gradient( center top, #e9e9e9 5%, #f9f9f9 100% );
98
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#e9e9e9", endColorstr="#f9f9f9");
99
+ background-color:#e9e9e9;
100
+ }
101
+ .readygraph_activate .aa_button:active {
102
+ position:relative;
103
+ top:1px;
104
+ }
105
+ /* This button was generated using CSSButtonGenerator.com */
106
+ .readygraph_activate .aa_description {
107
+ position:absolute;
108
+ top:19px;
109
+ left:285px;
110
+ margin-left:25px;
111
+ color:#ffffff;
112
+ font-size:15px;
113
+ z-index:1000
114
+ }
115
+ .readygraph_activate .aa_description strong {
116
+ color:#FFF;
117
+ font-weight:normal
118
+ }
119
+ .aa_close {
120
+ position: absolute;
121
+ right: 18px;
122
+ top: 18px;
123
+ }
124
+ </style>
125
+ <form name="readygraph_activate" action="'.admin_url( 'admin.php?page=' . $s2_menu_slug).'" method="POST">
126
+ <input type="hidden" name="return" value="1"/>
127
+ <div class="readygraph_activate">
128
+ <div class="aa_button" onclick="document.readygraph_activate.submit();">
129
+ '.__('Connect Your ReadyGraph Account').'
130
+ </div>
131
+ <div class="aa_description">'.__('<strong>Almost done</strong> - connect your account to start getting users.').'</div>
132
+ <div class="aa_close"><a href="' . $_SERVER["PHP_SELF"] . '?readygraph_notice=dismiss"><img src="'.plugin_dir_url( __FILE__ ).'assets/dialog_close.png"></a></div>
133
+ </div>
134
+ </form>
135
+ </div>';
136
+ }
137
  }
138
+
139
+ add_action('admin_notices', 'add_s2_readygraph_plugin_warning');
140
+ if(get_option('readygraph_application_id') && strlen(get_option('readygraph_application_id')) > 0){
141
+ if ((get_option('readygraph_access_token') && strlen(get_option('readygraph_access_token')) > 0)){
142
+ add_action('wp_footer', 's2_readygraph_client_script_head', 5);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  }
 
 
 
144
  }
145
+ add_action('admin_init', 'on_plugin_activated_readygraph_s2_redirect');
146
+ add_option('readygraph_connect_notice','true');
147
+
148
  function rg_s2_popup_options_enqueue_scripts() {
149
  if ( get_option('readygraph_popup_template') == 'default-template' ) {
150
  wp_enqueue_style( 'default-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/default-popup.css' );
167
  if ( get_option('readygraph_popup_template') == 'yellow-template' ) {
168
  wp_enqueue_style( 'yellow-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/yellow-popup.css' );
169
  }
170
+ if ( get_option('readygraph_popup_template') == 'custom-template' ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  wp_enqueue_style( 'custom-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/custom-popup.css' );
172
  }
173
  }
174
+ add_action( 'admin_enqueue_scripts', 'rg_s2_popup_options_enqueue_scripts' );
175
+ add_action( 'wp_enqueue_scripts', 'rg_s2_popup_options_enqueue_scripts' );
 
 
 
 
 
 
 
176
 
177
  function s2_post_updated_send_email( $post_id ) {
 
178
  // If this is just a revision, don't send the email.
179
+ $post_type = get_post_type( $post_id );
180
+ if ('page' != $post_type && 'post' != $post_type) return;
181
+ if ( wp_is_post_revision( $post_id ) ) return;
182
  if(get_option('readygraph_application_id') && strlen(get_option('readygraph_application_id')) > 0 && get_option('readygraph_send_blog_updates') == "true"){
183
+ $post_title = get_the_title( $post_id );
184
+ $post_url = get_permalink( $post_id );
185
+ $post_content = get_post($post_id);
186
+ $post_excerpt = (isset($post_content->post_excerpt) && (!empty($post_content->post_excerpt))) ? $post_content->post_excerpt : wp_trim_words(strip_tags(strip_shortcodes($post_content->post_content)),500);
187
+ $attachments = get_children(array('post_parent' => $post_id,
188
+ 'post_status' => 'inherit',
189
+ 'post_type' => 'attachment',
190
+ 'post_mime_type' => 'image',
191
+ 'order' => 'ASC',
192
+ 'orderby' => 'menu_order ID'));
193
+ $images_list = array();
194
+ foreach($attachments as $att_id => $attachment) {
195
+ $full_img_url = wp_get_attachment_url($attachment->ID);
196
+ $images_list[] = $full_img_url;
197
+ // Your Code here
198
+ }
199
+ $post_image = "";
200
+ if ($images_list) $post_image = reset($images_list);
201
+ $url = 'http://readygraph.com/api/v1/post.json/';
202
+ $response = wp_remote_post($url, array( 'body' => array('is_wordpress'=>1, 'message' => $post_title, 'message_link' => $post_url, 'message_image_link' => $post_image, 'message_excerpt' => $post_excerpt,'client_key' => get_option('readygraph_application_id'), 'email' => get_option('readygraph_email'))));
203
+ if ( is_wp_error( $response ) ) {
204
+ $error_message = $response->get_error_message();
205
+ } else {
206
+ }
207
+ $app_id = get_option('readygraph_application_id');
208
+ wp_remote_get( "http://readygraph.com/api/v1/tracking?event=post_created&app_id=$app_id" );
209
+ } else {
210
  }
211
+ }
212
+ add_action('future_to_publish','s2_post_updated_send_email');
213
+ add_action('new_to_publish','s2_post_updated_send_email');
214
+ add_action('draft_to_publish','s2_post_updated_send_email');
215
+
216
+
217
+ if(get_option('s2_wordpress_sync_users')) return;
218
  else {
219
+ add_action('plugins_loaded', 's2_wordpress_sync_users');
 
 
 
 
 
 
 
 
220
  }
221
+ function s2_wordpress_sync_users() {
222
+ if(get_option('s2_wordpress_sync_users') && get_option('s2_wordpress_sync_users') == "true") return;
223
+ else {
224
+ if(get_option('readygraph_application_id') && strlen(get_option('readygraph_application_id')) > 0){
225
+ global $wpdb;
226
+ $app_id = get_option('readygraph_application_id');
227
+ $query = "SELECT email as email, date as user_date FROM {$wpdb->prefix}subscribe2 ";
228
+ $subscribe2_users = $wpdb->get_results($query);
229
+ $emails = "";
230
+ $dates = "";
231
+ $count = 0;
232
+ $count = mysql_num_rows($subscribe2_users);
233
+ wp_remote_get( "http://readygraph.com/api/v1/tracking?event=wp_user_synced&app_id=$app_id&count=$count" );
234
+ foreach($subscribe2_users as $user) {
235
+ $emails .= $user->email . ",";
236
+ $dates .= $user->user_date . ",";
237
+ }
238
+ $url = 'https://readygraph.com/api/v1/wordpress-sync-enduser/';
239
+ $response = wp_remote_post($url, array( 'body' => array('app_id' => $app_id, 'email' => rtrim($emails, ", "), 'user_registered' => rtrim($dates, ", "))));
240
+ update_option('s2_wordpress_sync_users',"true");
241
+ remove_action('plugins_loaded', 's2_wordpress_sync_users');
242
+ }
243
+ }
244
  }
245
+
 
246
 
247
  ?>
subscribe2.php CHANGED
@@ -3,8 +3,8 @@
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.14
7
- Author: Matthew Robinson, tanaylakhani
8
  Author URI: http://subscribe2.wordpress.com
9
  Licence: GPL3
10
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=2387904
@@ -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.14' );
59
  define( 'S2PATH', trailingslashit(dirname(__FILE__)) );
60
  define( 'S2DIR', trailingslashit(dirname(plugin_basename(__FILE__))) );
61
  define( 'S2URL', plugin_dir_url(dirname(__FILE__)) . S2DIR );
@@ -84,8 +84,20 @@ function s2_install() {
84
  add_option('rg_s2_plugin_do_activation_redirect', true);
85
  }
86
  if( file_exists(plugin_dir_path( __FILE__ ).'/readygraph-extension.php' )) {
 
 
87
  include "readygraph-extension.php";
88
  }
 
 
 
 
 
 
 
 
 
 
89
  else {
90
 
91
  }
@@ -119,9 +131,21 @@ delete_option('readygraph_delay');
119
  delete_option('readygraph_enable_sidebar');
120
  delete_option('readygraph_auto_select_all');
121
  delete_option('readygraph_enable_notification');
 
122
  delete_option('readygraph_enable_branding');
123
  delete_option('readygraph_send_blog_updates');
124
  delete_option('readygraph_send_real_time_post_updates');
125
  delete_option('readygraph_popup_template');
 
 
 
 
 
 
 
 
 
 
126
  }
 
127
  ?>
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.8
7
+ Author: Matthew Robinson, Tanay Lakhani
8
  Author URI: http://subscribe2.wordpress.com
9
  Licence: GPL3
10
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=2387904
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.8' );
59
  define( 'S2PATH', trailingslashit(dirname(__FILE__)) );
60
  define( 'S2DIR', trailingslashit(dirname(plugin_basename(__FILE__))) );
61
  define( 'S2URL', plugin_dir_url(dirname(__FILE__)) . S2DIR );
84
  add_option('rg_s2_plugin_do_activation_redirect', true);
85
  }
86
  if( file_exists(plugin_dir_path( __FILE__ ).'/readygraph-extension.php' )) {
87
+ if (get_option('readygraph_deleted') && get_option('readygraph_deleted') == 'true'){}
88
+ else{
89
  include "readygraph-extension.php";
90
  }
91
+ if(get_option('readygraph_application_id') && strlen(get_option('readygraph_application_id')) > 0){
92
+ register_deactivation_hook( __FILE__, 's2_readygraph_plugin_deactivate' );
93
+ }
94
+ function s2_readygraph_plugin_deactivate(){
95
+ $app_id = get_option('readygraph_application_id');
96
+ update_option('readygraph_deleted', 'false');
97
+ wp_remote_get( "http://readygraph.com/api/v1/tracking?event=subscribe2_plugin_uninstall&app_id=$app_id" );
98
+ s2_delete_rg_options();
99
+ }
100
+ }
101
  else {
102
 
103
  }
131
  delete_option('readygraph_enable_sidebar');
132
  delete_option('readygraph_auto_select_all');
133
  delete_option('readygraph_enable_notification');
134
+ delete_option('readygraph_enable_popup');
135
  delete_option('readygraph_enable_branding');
136
  delete_option('readygraph_send_blog_updates');
137
  delete_option('readygraph_send_real_time_post_updates');
138
  delete_option('readygraph_popup_template');
139
+ delete_option('readygraph_upgrade_notice');
140
+ delete_option('readygraph_adsoptimal_secret');
141
+ delete_option('readygraph_adsoptimal_id');
142
+ delete_option('readygraph_connect_anonymous');
143
+ delete_option('readygraph_connect_anonymous_app_secret');
144
+ delete_option('readygraph_tutorial');
145
+ delete_option('readygraph_site_url');
146
+ delete_option('readygraph_enable_monetize');
147
+ delete_option('readygraph_monetize_email');
148
+ delete_option('readygraph_plan');
149
  }
150
+
151
  ?>
uninstall.php CHANGED
@@ -3,6 +3,11 @@ if ( !defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN') ) {
3
  // Make sure not to call this file directly
4
  exit();
5
  } else {
 
 
 
 
 
6
  // Is this WordPressMU or not?
7
  if ( isset($wpmu_version) || strpos($wp_version, 'wordpress-mu') ) {
8
  $s2_mu = true;
3
  // Make sure not to call this file directly
4
  exit();
5
  } else {
6
+ // Is Subscribe2 free active
7
+ if ( is_plugin_active( 'subscribe2_html/subscribe2.php' ) ) {
8
+ return;
9
+ }
10
+
11
  // Is this WordPressMU or not?
12
  if ( isset($wpmu_version) || strpos($wp_version, 'wordpress-mu') ) {
13
  $s2_mu = true;