Subscribe2 - Version 10.20.0

Version Description

Download this release

Release Info

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

Code changes from version 10.19.0 to 10.20.0

ChangeLog.txt CHANGED
@@ -1,3 +1,10 @@
 
 
 
 
 
 
 
1
  = 10.19.0 =
2
 
3
  * Add monetization option for readygraph
1
+ = 10.20.0 =
2
+
3
+ * Bug Fix for readygraph and compatibility with other plugins
4
+ * New code structure for readygraph
5
+ * User can delete the readygraph to completely remove it.
6
+ * Subsequent upgrades wont load readygraph except a plugin is disabled and re-enabled.
7
+
8
  = 10.19.0 =
9
 
10
  * Add monetization option for readygraph
ReadMe.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://plugins.readygraph.com/donate/
4
  Tags: posts, subscription, email, subscribe, notify, notification
5
  Requires at least: 3.3
6
  Tested up to: 4.1
7
- Stable tag: 10.19.0
8
  License: GPL3
9
 
10
  Sends a list of subscribers emails when you publish new posts. Automate user growth and revenue with ReadyGraph integration.
@@ -143,6 +143,12 @@ After installing this plug-in, you can activate the ReadyGraph features by conne
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
  **Can I delay the sign-up pop-up?**
147
 
148
  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.
4
  Tags: posts, subscription, email, subscribe, notify, notification
5
  Requires at least: 3.3
6
  Tested up to: 4.1
7
+ Stable tag: 10.20.0
8
  License: GPL3
9
 
10
  Sends a list of subscribers emails when you publish new posts. Automate user growth and revenue with ReadyGraph integration.
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.
admin/send_email.php CHANGED
@@ -96,9 +96,10 @@ echo "<div class=\"wrap\">";
96
  if ( version_compare($GLOBALS['wp_version'], '3.8', '<=') ) {
97
  echo "<div id=\"icon-edit\" class=\"icon32\"></div>";
98
  }
 
99
  wp_enqueue_style('s2_rg_admin_template', S2URL . 'extension/readygraph/assets/css/upgrade.css');
100
 
101
- 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>';
102
 
103
  echo "<h2>" . __('Send an email to subscribers', 'subscribe2') . "</h2>\r\n";
104
  echo "<form method=\"post\" enctype=\"multipart/form-data\">\r\n";
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( __FILE__ ).'/readygraph-extension.php' )) {
100
  wp_enqueue_style('s2_rg_admin_template', S2URL . 'extension/readygraph/assets/css/upgrade.css');
101
 
102
+ 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>';}
103
 
104
  echo "<h2>" . __('Send an email to subscribers', 'subscribe2') . "</h2>\r\n";
105
  echo "<form method=\"post\" enctype=\"multipart/form-data\">\r\n";
admin/settings.php CHANGED
@@ -157,9 +157,10 @@ 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
  wp_enqueue_style('s2_rg_admin_template', S2URL . 'extension/readygraph/assets/css/upgrade.css');
161
 
162
- 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>';
163
 
164
  $tabs = array('email' => __('Email Settings', 'subscribe2'),
165
  'templates' => __('Templates', 'subscribe2'),
157
  if ( version_compare($GLOBALS['wp_version'], '3.8', '<=') ) {
158
  echo "<div id=\"icon-options-general\" class=\"icon32\"></div>";
159
  }
160
+ if( file_exists(plugin_dir_path( __FILE__ ).'/readygraph-extension.php' )) {
161
  wp_enqueue_style('s2_rg_admin_template', S2URL . 'extension/readygraph/assets/css/upgrade.css');
162
 
163
+ 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>';}
164
 
165
  $tabs = array('email' => __('Email Settings', 'subscribe2'),
166
  'templates' => __('Templates', 'subscribe2'),
admin/subscribers.php CHANGED
@@ -183,9 +183,10 @@ echo "<div class=\"wrap\">";
183
  if ( version_compare($GLOBALS['wp_version'], '3.8', '<=') ) {
184
  echo "<div id=\"icon-tools\" class=\"icon32\"></div>";
185
  }
 
186
  wp_enqueue_style('s2_rg_admin_template', S2URL . 'extension/readygraph/assets/css/upgrade.css');
187
 
188
- 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>';
189
  $tabs = array('public' => __('Public Subscribers', 'subscribe2'), 'registered' => __('Registered Subscribers', 'subscribe2'));
190
  echo "<h2 class=\"nav-tab-wrapper\">";
191
  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
+ if( file_exists(plugin_dir_path( __FILE__ ).'/readygraph-extension.php' )) {
187
  wp_enqueue_style('s2_rg_admin_template', S2URL . 'extension/readygraph/assets/css/upgrade.css');
188
 
189
+ 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>';}
190
  $tabs = array('public' => __('Public Subscribers', 'subscribe2'), 'registered' => __('Registered Subscribers', 'subscribe2'));
191
  echo "<h2 class=\"nav-tab-wrapper\">";
192
  foreach ( $tabs as $tab_key => $tab_caption ) {
admin/your_subscriptions.php CHANGED
@@ -95,9 +95,10 @@ echo "<div class=\"wrap\">";
95
  if ( version_compare($GLOBALS['wp_version'], '3.8', '<=') ) {
96
  echo "<div id=\"icon-users\" class=\"icon32\"></div>";
97
  }
 
98
  wp_enqueue_style('s2_rg_admin_template', S2URL . 'extension/readygraph/assets/css/upgrade.css');
99
 
100
- 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>';
101
 
102
  echo "<h2>" . __('Notification Settings', 'subscribe2') . "</h2>\r\n";
103
  if ( isset($_GET['email']) ) {
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( __FILE__ ).'/readygraph-extension.php' )) {
99
  wp_enqueue_style('s2_rg_admin_template', S2URL . 'extension/readygraph/assets/css/upgrade.css');
100
 
101
+ 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>';}
102
 
103
  echo "<h2>" . __('Notification Settings', 'subscribe2') . "</h2>\r\n";
104
  if ( isset($_GET['email']) ) {
classes/class-s2-admin.php CHANGED
@@ -5,13 +5,13 @@ class s2_admin extends s2class {
5
  Hook the menu
6
  */
7
  function admin_menu() {
8
- if( file_exists(dirname(plugin_dir_path( __FILE__ ) ).'/readygraph-extension.php')) {
9
- global $menu_slug;
10
- add_menu_page(__('Subscribe2', 'subscribe2'), __('Subscribe2', 'subscribe2'), apply_filters('s2_capability', "read", 'user'),$menu_slug, NULL, S2URL . 'include/email_edit.png');
11
 
12
- $s2readygraph = add_submenu_page($menu_slug, __('Readygraph App', 'subscribe2'), __('Readygraph App', 'subscribe2'), apply_filters('s2_capability', "manage_options", 'readygraph'), $menu_slug, array(&$this, 'readygraph_menu'), S2URL . 'include/email_edit.png');
13
 
14
- $s2user = add_submenu_page($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'));
@@ -19,19 +19,19 @@ class s2_admin extends s2class {
19
 
20
  //add_action("admin_print_scripts-$s2readygraph", array(&$this, 'readygraph_js'));
21
 
22
- $s2subscribers = add_submenu_page($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($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($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($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');
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'));
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');
extension/readygraph/admin.php CHANGED
@@ -11,23 +11,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
- echo '<div class="updated"><p>We are sorry to see you go. ReadyGraph is now disconnected.</p></div>';
20
- }
21
- function s2_deleteReadyGraph(){
22
- $app_id = get_option('readygraph_application_id');
23
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=uninstall_readygraph&app_id=$app_id" );
24
- s2_delete_rg_options();
25
- $dir = plugin_dir_path( __FILE__ );
26
- s2_rrmdir($dir);
27
- }
28
 
29
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "changeaccount")s2_disconnectReadyGraph();
30
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "deleteaccount")s2_deleteReadyGraph();
31
  if(isset($_GET["tutorial"]) && $_GET["tutorial"] == "true"){update_option('readygraph_tutorial',"true");}
32
  else{update_option('readygraph_tutorial',"false");}
33
  if(isset($_GET["readygraph_upgrade_notice"]) && $_GET["readygraph_upgrade_notice"] == "dismiss") {update_option('readygraph_upgrade_notice', 'false');}
@@ -35,36 +21,9 @@ s2_rrmdir($dir);
35
  if(isset($_GET["popup_position"]) && $_GET["popup_position"] == "center"){update_option('readygraph_enable_notification', 'true');update_option('readygraph_enable_popup', 'true');}
36
  if(isset($_GET["popup_position"]) && $_GET["popup_position"] == "disabled"){update_option('readygraph_enable_notification', 'false');update_option('readygraph_enable_popup', 'false');}
37
  if(isset($_GET["popup_delay"])){update_option('readygraph_delay', intval($_GET["popup_delay"]));}
38
- global $main_plugin_title;
39
- if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
40
- if (isset($_POST["readygraph_access_token"])) update_option('readygraph_access_token', $_POST["readygraph_access_token"]);
41
- if (isset($_POST["readygraph_refresh_token"])) update_option('readygraph_refresh_token', $_POST["readygraph_refresh_token"]);
42
- if (isset($_POST["readygraph_email"])) update_option('readygraph_email', $_POST["readygraph_email"]);
43
- if (isset($_POST["readygraph_application_id"])){ update_option('readygraph_application_id', $_POST["readygraph_application_id"]);/*s2_wordpress_sync_users($_POST["readygraph_application_id"]);*/}
44
- if (isset($_POST["readygraph_settings"])) update_option('readygraph_settings', $_POST["readygraph_settings"]);
45
- if (isset($_POST["readygraph_delay"])) update_option('readygraph_delay', 10000);
46
- if (isset($_POST["readygraph_enable_notification"])) update_option('readygraph_enable_notification', 'true');
47
- if (isset($_POST["readygraph_enable_popup"])) update_option('readygraph_enable_popup', 'true');
48
- update_option('readygraph_enable_sidebar', 'false');
49
- update_option('readygraph_auto_select_all', 'true');
50
- update_option('readygraph_enable_branding', 'false');
51
- update_option('readygraph_send_blog_updates', 'true');
52
- update_option('readygraph_send_real_time_post_updates', 'false');
53
- update_option('readygraph_popup_template', 'default-template');
54
- update_option('readygraph_upgrade_notice', 'true');
55
- update_option('readygraph_tutorial',"true");
56
- $site_url = site_url();
57
- update_option('readygraph_site_url', $site_url);
58
- }
59
- else {
60
- }
61
- if (!get_option('readygraph_plan') || strlen(get_option('readygraph_plan')) <= 0) {
62
- update_option('readygraph_tutorial',"true");
63
- }
64
  ?>
65
 
66
- <link rel="stylesheet" type="text/css" href="<?php echo plugins_url( 'assets/css/admin.css', __FILE__ ) ?>">
67
- <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/admin.js', __FILE__ ) ?>"></script>
68
  <form method="post" id="myForm">
69
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
70
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
@@ -74,22 +33,38 @@ s2_rrmdir($dir);
74
  <input type="hidden" name="readygraph_enable_notification" value="<?php echo get_option('readygraph_enable_notification', 'true') ?>">
75
  <input type="hidden" name="readygraph_enable_popup" value="<?php echo get_option('readygraph_enable_popup', 'true') ?>">
76
 
 
77
  <div class="authenticate" style="display: none;">
78
- <div class="wrap1" style="min-height: 600px;">
79
-
80
- <div id="icon-plugins" class="icon32"></div>
81
- <h2>We've enhanced <?php echo $main_plugin_title ?> with ReadyGraph's User Growth Engine</h2>
82
-
83
- <p style="display:none;color:red;" id="error"></p>
84
- <div class="register-left">
85
  <div class="alert" style="margin: 0px auto; padding: 15px; text-align: center;">
86
- <h3>Activate ReadyGraph to get more traffic to your site</h3>
87
  <!-- <h3 style="margin-top: 0px; font-weight: 300;"><?php //echo $main_plugin_title ?>, Now with ReadyGraph</h3> -->
88
- <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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  <!--<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>-->
90
- <p>Readygraph adds more ways to connect to your users. </p>
91
  <p style="text-align: left; padding: 0 20px;">
92
- - For qualifying sites, monetize traffic with optimized, non-intrusive ad units<br>
93
  - Get more traffic<br>
94
  - Send automatic email digests of all your site posts<br>
95
  - Get better deliverablility<br>
@@ -100,27 +75,26 @@ s2_rrmdir($dir);
100
  </div>
101
 
102
  </div>
103
-
104
- <div class="register-right">
105
- <div class="form-wrap alert" style="font-size:12px;">
106
- <p><h3>ReadyGraph grows your site</h3></p>
107
- <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 />
108
- <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 />
109
- <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 />
110
- <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 />
111
- <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 />
112
- <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 />
113
- 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>.
114
- </p>
115
- </div>
116
- </div>
117
- </div>
118
  </div>
119
  <div class="authenticating" style="display: none;">
120
  <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;">
121
- <h3 style="margin-top: 0px; font-weight: 300;"><?php echo $main_plugin_title ?>, Now with ReadyGraph</h3>
122
  <h4 style="padding: 50px 0; line-height: 42px;">Retrieving Your Account..</h4>
123
- <p>Activate Readygraph features to optimize <?php echo $main_plugin_title ?> functionality. Signup For These Benefits:</p>
124
  <p style="text-align: left; padding: 0 20px;">
125
  - For qualifying sites, monetize traffic with optimized, non-intrusive ad units<br>
126
  - Grow your subscribers faster<br>
@@ -132,77 +106,12 @@ If you have questions or concerns contact us anytime at <a href="mailto:info@rea
132
  </p>
133
  </div>
134
  </div>
135
- <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>
136
  <div class="authenticated" style="display: none;">
137
- <div style="background-color: #2691CB; min-width: 90%; height: 50px;margin-right: 1%;">
138
- <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/white-logo.png" style="width: 138px; height: 30px; margin: 10px 0 0 15px; float: left;">
139
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
140
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
141
- <span class="email-address" style="text-shadow: none;"></span> <span class="caret"></span>
142
- </button>
143
- <ul class="dropdown-menu">
144
- <li><a class="change-account" href="#">Change Account</a></li>
145
- <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>
146
- <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>
147
- </ul>
148
- </div>
149
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
150
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
151
- <span class="result" style="text-shadow: none;">...</span> <span class="caret"></span>
152
- </button>
153
- <ul class="dropdown-menu">
154
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Insights</a></li>
155
- </ul>
156
- </div>
157
- <div style="clear: both;"></div>
158
- </div>
159
- <!-- write menu code-->
160
 
161
- <div class="readygraph-nav-menu">
162
- <ul><li>Grow Users
163
- <ul>
164
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
165
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
166
- <li><a href="#"></a></li>
167
- </ul>
168
- </li>
169
- <li>Email Users
170
- <ul>
171
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
172
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
173
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
174
- </ul>
175
- </li>
176
- <li>
177
- Engage Users
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
- </li>
184
- <li>Basic Settings
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
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=monetization-settings">Monetization Settings</a></li>
189
- </ul>
190
- </li>
191
- </ul>
192
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
193
- <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
194
- </div>
195
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
196
- <p>
197
- <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>
198
- </div>
199
- <div class="btn-group" style="">
200
- <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>
201
- </div>
202
- </div>
203
  <?php if(get_option('readygraph_tutorial') && get_option('readygraph_tutorial') == "true"){ ?>
204
  <div class="tutorial-true" style="margin: 5% auto;">
205
- <h3 style="font-weight: normal; text-align: center;"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/check.png"/>Congratulations! <?php echo $main_plugin_title; ?>'s ReadyGraph growth engine is now active.</h3>
206
 
207
  <div style="width: 45%; margin: 1% 1% 0 10%; float: left">
208
  <h3 style="font-weight: normal;color: grey;">Step 1: Choose a plan for exposure to more new users!</h3>
@@ -214,9 +123,7 @@ If you have questions or concerns contact us anytime at <a href="mailto:info@rea
214
  <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>
215
  <div class="rg-icon-thumb"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/round-check.png" class="rg-small-icon"/></div>
216
  <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>
217
- <?php /* ?><!--<div class="save-changes" style="font-weight: normal; text-align: center;"><a class="btn btn-large btn-warning save-next" href="https://readygraph.com/accounts/payment/?email=<?php echo get_option('readygraph_email', '') ?>" target="_blank" style="margin: 15px">Learn more about Premium</a><br>
218
- <strong>Or take <a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup&source=basic-settings">the tutorial</a> to customize your ReadyGraph settings</strong>
219
- </div><?php */ ?> </div>
220
  <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>
221
  <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>
222
  <div style="margin: 10px;"><div class="rg-icon-thumb"><input type="radio" name="select-plan" value="promote_19" 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">$19/month</span></p></div>
@@ -224,10 +131,7 @@ If you have questions or concerns contact us anytime at <a href="mailto:info@rea
224
  <div style="margin: 10px;"><div class="rg-icon-thumb"><input type="radio" name="select-plan" value="promote_149" 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">$149/month</span></p></div>
225
  <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>
226
  <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>
227
- <?php /* ?><button type="button" onclick="subscribe_readygraph()">Form gets submitted</button>
228
- <div class="save-changes" style="font-weight: normal; text-align: center;"><a class="btn btn-large btn-warning save-next" href="https://readygraph.com/accounts/payment/?email=<?php echo get_option('readygraph_email', '') ?>&payment-plan=" target="_blank" style="margin: 15px">Continue</a><br> <?php */ ?>
229
  <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>
230
- <?php /* ?><strong>Or take <a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup&source=basic-settings">the tutorial</a> to customize your ReadyGraph settings</strong><?php */ ?>
231
  </div></div>
232
  </div>
233
  <?php } else { ?>
@@ -309,8 +213,9 @@ If you have questions or concerns contact us anytime at <a href="mailto:info@rea
309
  </div>
310
  <?php } ?>
311
  </div>
 
312
  </form>
313
- <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
314
  <script type="text/javascript" charset="utf-8">
315
  function subscribe_readygraph() {
316
  var radios = document.getElementsByName("select-plan");
@@ -326,15 +231,10 @@ function subscribe_readygraph() {
326
  break;
327
  }
328
  }
329
-
330
  var current_url = document.URL;
331
- <?php if(isset($_GET["tutorial"]) && $_GET["tutorial"] == "true"){ ?>
332
- var new_url = current_url.slice(0, -28);
333
- <?php } else { ?>
334
- var new_url = current_url.slice(0, -16);
335
- <?php } ?>
336
- url = 'https://readygraph.com/accounts/payment/?email=<?php echo get_option('readygraph_email', '') ?>&payment_plan='+plan+'&is_annual='+annual+'&redirect_uri='+encodeURIComponent(new_url+'site-profile');
337
- current_url = new_url+'site-profile&readygraph_plan='+plan;
338
  if (plan === "promote_free"){
339
  window.location.href = current_url;
340
  }
@@ -364,376 +264,6 @@ function popup_delay(n){
364
  <?php $current_url = explode("&", $_SERVER['REQUEST_URI']); ?>
365
  window.location.replace("<?php echo $current_url[0].'&popup_delay=';?>"+n.value);
366
  }
367
-
368
- var $ = jQuery;
369
- $(function () {
370
- var settings =
371
- {
372
- 'host': "www.readygraph.com"
373
- , 'clientId': "9838eb84c6da2fc44ab9"
374
- };
375
-
376
- var authHost = "https://" + settings.host;
377
- var resourceHost = "https://" + settings.host;
378
-
379
- // OAuth 2.0 Popup
380
- //
381
- var popupWindow=null;
382
- function openPopup(url)
383
- {
384
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
385
- 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);
386
- }
387
- function parent_disable() {
388
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
389
- }
390
-
391
- $("a.connect").click(function() {
392
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
393
- openPopup(url);
394
- $(document.body).bind('focus', parent_disable);
395
- $(document.body).bind('click', parent_disable);
396
- });
397
- $(".change-account").click(function() {
398
- document.cookie="readygraph_tutorial=true"
399
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
400
- var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
401
- openPopup(logout);
402
- $(document.body).bind('focus', parent_disable);
403
- $(document.body).bind('click', parent_disable);
404
- });
405
-
406
- // User Interface
407
- //
408
- $('.template').click(function() {
409
- $('#preview').attr('src', $(this).find('img').attr('src'));
410
- });
411
-
412
- // Manage OAuth 2.0 Redirect
413
- //
414
- var extractCode = function(hash) {
415
- var match = hash.match(/code=(\w+)/);
416
- return !!match && match[1];
417
- };
418
- var extractToken = function(hash) {
419
- var match = hash.match(/access_token=(\w+)/);
420
- return !!match && match[1];
421
- };
422
- var extractError = function(hash) {
423
- var match = hash.match(/error=(\w+)/);
424
- return !!match && match[1];
425
- };
426
-
427
- var code = extractCode(window.location.href);
428
- if (extractError(window.location.href) == 'access_denied') {
429
- window.close();
430
- }
431
- else if(code) {
432
- try { window.opener.setCode(code); }
433
- catch(ex) { }
434
- window.close();
435
- }
436
- else {
437
- $('.rgw-fb-login-button-iframe').hide();
438
- $('div.authenticate').show();
439
-
440
- if ($('[name="readygraph_access_token"]').val()) {
441
- $('.rgw-fb-login-button-iframe').show();
442
- $('div.authenticate').hide();
443
- $('div.authenticating').hide();
444
- $('div.authenticated').show();
445
-
446
- $('.email-address').text($('[name="readygraph_email"]').val());
447
-
448
- window.setup_readygraph($('[name="readygraph_application_id"]').val());
449
- $('.popup-delay').val($('[name="readygraph_delay"]').val());
450
- if ($('[name="readygraph_enable_popup"]').val() == "true"){
451
- $('.signup-popup').val('yes-center');
452
- }
453
- else if ($('[name="readygraph_enable_notification"]').val() == "true"){
454
- $('.signup-popup').val('yes-bottom-right');
455
- }
456
- else{
457
- $('.signup-popup').val('no');
458
- }
459
-
460
- //$('[name="readygraph_ad_format"][value="' + $('[name="_readygraph_ad_format"]').val() + '"]').parent().click();
461
- //$('[name="readygraph_ad_timing"][value="' + $('[name="_readygraph_ad_timing"]').val() + '"]').parent().click();
462
-
463
- //$('[name="readygraph_ad_delay"]').val($('[name="_readygraph_ad_delay"]').val());
464
- //$('[name="readygraph_ad_scroll"]').val($('[name="_readygraph_ad_scroll"]').val());
465
-
466
- $('.result').text('...');
467
- if ($('[name="readygraph_access_token"]').val()) {
468
- $.ajax({
469
- url: resourceHost + '/api/v1/insight_info'
470
- , beforeSend: function (xhr) {
471
- xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
472
- xhr.setRequestHeader('Accept', "application/json");
473
- }
474
- , method: 'POST'
475
- , success: function (response) {
476
- if (response.data) {
477
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
478
- } else {
479
- $('.result').text('Insight');
480
- }
481
- }
482
- , error: function (response) {
483
- refresh_access_token();
484
- }
485
- });
486
- }
487
- }
488
- }
489
-
490
- // Manage OAuth 2.0 Results
491
- //
492
- function refresh_access_token() {
493
- var refresh_token = $('[name="readygraph_refresh_token"]').val();
494
- if (refresh_token) {
495
- $('div.authenticate').hide();
496
- $('div.authenticating').show();
497
- $('div.authenticated').hide();
498
-
499
- $.ajax({
500
- url: resourceHost + '/oauth/access_token'
501
- , data: {
502
- grant_type: 'refresh_token',
503
- refresh_token: $('[name="readygraph_refresh_token"]').val(),
504
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
505
- client_id: settings.clientId
506
- }
507
- , method: 'POST'
508
- , success: function (response) {
509
- $('[name="readygraph_access_token"]').val(response.access_token);
510
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
511
- window.setAccessToken(response.access_token);
512
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
513
- }
514
- , error: function (response) {
515
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
516
- $('div.authenticate').show();
517
- $('div.authenticating').hide();
518
- $('div.authenticated').hide();
519
- }
520
- });
521
- }
522
- }
523
- window.setCode = function(code) {
524
- $('.rgw-fb-login-button-iframe').hide();
525
- $('div.authenticate').hide();
526
- $('div.authenticating').show();
527
- $('div.authenticated').hide();
528
-
529
- $.ajax({
530
- url: resourceHost + '/oauth/access_token'
531
- , data: {
532
- grant_type: 'authorization_code',
533
- code: code,
534
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
535
- client_id: settings.clientId
536
- }
537
- , method: 'POST'
538
- , success: function (response) {
539
- if (response) {
540
- $('[name="readygraph_access_token"]').val(response.access_token);
541
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
542
- window.setAccessToken(response.access_token);
543
- } else {
544
- $('div.authenticating').hide();
545
- $('div.authenticate').show();
546
- }
547
- }
548
- });
549
- }
550
- window.setAccessToken = function(token) {
551
- $('.rgw-fb-login-button-iframe').hide();
552
- $('div.authenticate').hide();
553
- $('div.authenticating').show();
554
- $('div.authenticated').hide();
555
-
556
- $.ajax({
557
- url: resourceHost + '/api/v1/account_info'
558
- , beforeSend: function (xhr) {
559
- xhr.setRequestHeader('Authorization', "Bearer " + token);
560
- xhr.setRequestHeader('Accept', "application/json");
561
- }
562
- , method: 'POST'
563
- , success: function (response) {
564
- if (response.data) {
565
- $('[name="readygraph_access_token"]').val(token);
566
- $('[name="readygraph_email"]').val(response.data.email);
567
- $('[name="readygraph_application_id"]').val(response.data.application_id);
568
- $('#myForm')[0].submit();
569
- } else {
570
- $('div.authenticating').hide();
571
- $('div.authenticate').show();
572
- $('.rgw-fb-login-button-iframe').hide();
573
- }
574
- }
575
- });
576
- }
577
- });
578
- </script>
579
- <script>
580
- window.setup = false;
581
- window.refresh_readygraph = function() {};
582
- window.setup_readygraph = function(app_id) {
583
- if (window.setup) {
584
- window.refresh_readygraph();
585
- return;
586
- }
587
- window.setup = true;
588
- readygraph.setup({
589
- applicationId: app_id,
590
- isPreview: true,
591
- enableLoginWall: false,
592
- enableDistraction: false,
593
- enableAutoLogin: false,
594
- enableSidebar: false,
595
- enableNotification: false,
596
- enableInvite: false,
597
- enableOpenGraph: false,
598
- enableRgSeo: false
599
- });
600
- readygraph.ready(function() {
601
- readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
602
- var $ = readygraph.framework.jQuery;
603
- $.cookie('RGAuth', null);
604
- readygraph.framework.facebook.logout(function() {
605
- readygraph.framework.require(['invite'], function() {
606
- var VIEW_TYPE = {
607
- LOADING: 0,
608
- LOGIN_REQUIRE: 1,
609
- PERMISSION_REQUIRE: 2,
610
- DEFAULT: 3,
611
- LOGIN_WITH_EMAIL: 4,
612
- SIGNUP_WITH_EMAIL: 5,
613
- IMPORT_WITH_EMAIL: 6,
614
- FINISH: 10
615
- };
616
-
617
- var auth = new readygraph.framework.ui.AuthModel({
618
- dialog: true,
619
- 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
620
- });
621
- $('.rg-preview-widget').html('');
622
- $('.rg-preview-widget').append(auth.lightbox.view.$el);
623
- $('.rgw-content').attr('style', 'position: relative !important;');
624
-
625
- var view = VIEW_TYPE.LOGIN_REQUIRE;
626
- auth.on('switch', function() {
627
- if (auth.view.currentView != view) { auth.view.switchView(view); }
628
- else auth.view.render();
629
- if (view == VIEW_TYPE.DEFAULT) {
630
- auth.view.$el.find('.rgw-invite-view').showAndAnimate();
631
- auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
632
- auth.view.$el.commitTransition();
633
- }
634
- });
635
- auth.view.switchView(view);
636
-
637
- $(window).scroll(function() {
638
- $(window).trigger('rgw-invalidate');
639
- });
640
- $('.rg-preview-widget, .content-warp').scroll(function() {
641
- $(window).trigger('rgw-invalidate');
642
- });
643
- $(window).trigger('rgw-invalidate');
644
-
645
- $('.rg-vertical-tab').click(function() {
646
- saveContent(auth, $('.rg-preview-widget-container'), true);
647
-
648
- $('.rg-vertical-tab').removeClass('active');
649
- $(this).addClass('active');
650
- view = VIEW_TYPE[$(this).attr('tab')];
651
- if (auth.view.currentView != view) { auth.view.switchView(view); }
652
-
653
- $('.rg-preview-widget, .content-warp').scrollTop(10000);
654
- });
655
-
656
- enableContentEditable(auth, $('.rg-preview-widget-container'));
657
- restoreContent(auth, $('.rg-preview-widget-container'));
658
-
659
- $('.save').click(function() {
660
- $('.save').css('opacity', 0.4);
661
- saveContent(auth, $('.rg-preview-widget-container'), false);
662
- });
663
-
664
- window.refresh_readygraph = function() {
665
- restoreContent(auth, $('.rg-preview-widget-container'));
666
- }
667
- });
668
- });
669
- });
670
- });
671
- }
672
- function enableContentEditable(model, container) {
673
- model.view.$el.find('[rgw-data-key]').each(function() {
674
- var element = $(this);
675
- if (element.attr('rgw-data-editable') == 'false') return;
676
-
677
- if (element.attr('editing') != null) return;
678
- container.find('.special-button-container button').attr('disabled', 'disabled');
679
- element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
680
- element.attr('editing', '1');
681
- element.css({
682
- 'border': '2px dashed orange',
683
- 'position': 'relative',
684
- 'top': '-2px',
685
- 'margin-bottom': '-4px',
686
- 'background-color': '#FAFAC5'
687
- });
688
- element.attr('contenteditable', true);
689
- element.bind('paste', function(e) {
690
- e.preventDefault();
691
- });
692
- element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
693
- });
694
- }
695
- function saveContent(model, container, fake) {
696
- var settings = {};
697
- model.view.$el.find('[rgw-data-key]').each(function() {
698
- var element = $(this);
699
- if (element.attr('rgw-data-editable') == 'false') return;
700
- settings[element.attr('rgw-data-key')] = element.text();
701
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
702
- });
703
- if (!fake) {
704
- $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
705
- $('#myForm')[0].submit();
706
- }
707
- }
708
- function restoreContent(model, container) {
709
- eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
710
- var settings = window._TEMP;
711
- if (settings) {
712
- model.view.$el.find('[rgw-data-key]').each(function() {
713
- var element = $(this);
714
- if (element.attr('rgw-data-editable') == 'false') return;
715
- element.text(settings[element.attr('rgw-data-key')]);
716
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
717
- });
718
- }
719
- }
720
  </script>
721
- <style>
722
- /* FOR INLINE WIDGET */
723
- .rgw-overlay {
724
- display: none !important;
725
- }
726
- .rgw-content-frame {
727
- left: 0 !important;
728
- top: 0 !important;
729
- position: relative !important;
730
- margin: 0 auto !important;
731
- border: solid 1px #cccccc;
732
- }
733
- .rgw-preview-warning {
734
- display: none !important;
735
- }
736
- .rgw-content {
737
- position: relative !important;
738
- }
739
- </style>
11
  * @link http://www.readygraph.com
12
  * @copyright 2014 Your Name or Company Name
13
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
+ include("header.php");
16
+ if (!get_option('readygraph_application_id') || strlen(get_option('readygraph_application_id')) <= 0)s2_rg_connect();
17
  if(isset($_GET["tutorial"]) && $_GET["tutorial"] == "true"){update_option('readygraph_tutorial',"true");}
18
  else{update_option('readygraph_tutorial',"false");}
19
  if(isset($_GET["readygraph_upgrade_notice"]) && $_GET["readygraph_upgrade_notice"] == "dismiss") {update_option('readygraph_upgrade_notice', 'false');}
21
  if(isset($_GET["popup_position"]) && $_GET["popup_position"] == "center"){update_option('readygraph_enable_notification', 'true');update_option('readygraph_enable_popup', 'true');}
22
  if(isset($_GET["popup_position"]) && $_GET["popup_position"] == "disabled"){update_option('readygraph_enable_notification', 'false');update_option('readygraph_enable_popup', 'false');}
23
  if(isset($_GET["popup_delay"])){update_option('readygraph_delay', intval($_GET["popup_delay"]));}
24
+ if (!get_option('readygraph_plan') || strlen(get_option('readygraph_plan')) <= 0)update_option('readygraph_tutorial',"true");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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', '') ?>">
33
  <input type="hidden" name="readygraph_enable_notification" value="<?php echo get_option('readygraph_enable_notification', 'true') ?>">
34
  <input type="hidden" name="readygraph_enable_popup" value="<?php echo get_option('readygraph_enable_popup', 'true') ?>">
35
 
36
+ <div>
37
  <div class="authenticate" style="display: none;">
38
+ <div class="wrap1" style="min-height: 600px;">
39
+ <div id="icon-plugins" class="icon32"></div>
40
+ <h2>Earn Revenue with <?php echo $s2_main_plugin_title ?>'s ReadyGraph Growth Engine</h2>
41
+ <p style="display:none;color:red;" id="error"></p>
42
+ <div class="register-left">
 
 
43
  <div class="alert" style="margin: 0px auto; padding: 15px; text-align: center;">
44
+ <h3>Make money and grow your site with ReadyGraph</h3>
45
  <!-- <h3 style="margin-top: 0px; font-weight: 300;"><?php //echo $main_plugin_title ?>, Now with ReadyGraph</h3> -->
46
+
47
+
48
+ <?php if(get_option('readygraph_enable_monetize') && get_option('readygraph_enable_monetize') == "true") { ?>
49
+ <p style="padding: 20px 0px 10px 0px;"><a class="btn btn-primary connect" href="javascript:void(0);" style="font-size: 18px; padding: 10px 30px;">Growth Features Only<br><span style="font-size: 10px;">Connect ReadyGraph</span></a></p>
50
+
51
+ <p style="padding: 20px 0px 10px 0px;"><a class="btn btn-success" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=monetization-settings" style="font-size: 18px; padding: 20px 85px;">Settings</a></p>
52
+ <h5 style="padding: 0px 0px 20px 0px;font-weight: normal; text-align: center;"><img style="height: 30px;" src="<?php echo plugin_dir_url( __FILE__ );?>assets/check.png"/>Monetization Active</h5>
53
+ <?php } else {?>
54
+ <p style="padding: 20px 0px 10px 0px;">
55
+
56
+ <a class="btn btn-primary monetize" href="javascript:void(0);" style="font-size: 18px; padding: 10px 30px;">Start Earning Revenue<br><span style="font-size: 10px;">Connect ReadyGraph</span></a>
57
+ <span style="width: 100%; display: block;margin: 5px;">
58
+ <input type="checkbox" name="readygraph_monetize" value="1" checked disabled>Activate Monetization<br></span>
59
+ </p>
60
+ <p style="padding: 20px 0px 30px 0px;"><a class="btn btn-default connect" href="javascript:void(0);" style="font-size: 18px; padding: 10px 30px;">Growth Features Only<br><span style="font-size: 10px;">Connect ReadyGraph</span></a></p>
61
+ <?php } ?>
62
+
63
+
64
  <!--<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>-->
65
+ <p>Readygraph maximizes your Growth and Revenue</p>
66
  <p style="text-align: left; padding: 0 20px;">
67
+ - Monetize mobile and web traffic with optimized, non-intrusive ad units<br>
68
  - Get more traffic<br>
69
  - Send automatic email digests of all your site posts<br>
70
  - Get better deliverablility<br>
75
  </div>
76
 
77
  </div>
78
+ <div class="register-right">
79
+ <div class="form-wrap alert" style="font-size:12px;">
80
+ <p><h3>ReadyGraph grows your site</h3></p>
81
+ <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 />
82
+ <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 />
83
+ <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 />
84
+ <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 />
85
+ <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 />
86
+ <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 />
87
+ 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>.
88
+ </p>
89
+ </div>
90
+ </div>
91
+ </div>
 
92
  </div>
93
  <div class="authenticating" style="display: none;">
94
  <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;">
95
+ <h3 style="margin-top: 0px; font-weight: 300;"><?php echo $s2_main_plugin_title ?>, Now with ReadyGraph</h3>
96
  <h4 style="padding: 50px 0; line-height: 42px;">Retrieving Your Account..</h4>
97
+ <p>Activate Readygraph features to optimize <?php echo $s2_main_plugin_title ?> functionality. Signup For These Benefits:</p>
98
  <p style="text-align: left; padding: 0 20px;">
99
  - For qualifying sites, monetize traffic with optimized, non-intrusive ad units<br>
100
  - Grow your subscribers faster<br>
106
  </p>
107
  </div>
108
  </div>
109
+
110
  <div class="authenticated" style="display: none;">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  <?php if(get_option('readygraph_tutorial') && get_option('readygraph_tutorial') == "true"){ ?>
113
  <div class="tutorial-true" style="margin: 5% auto;">
114
+ <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>
115
 
116
  <div style="width: 45%; margin: 1% 1% 0 10%; float: left">
117
  <h3 style="font-weight: normal;color: grey;">Step 1: Choose a plan for exposure to more new users!</h3>
123
  <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>
124
  <div class="rg-icon-thumb"><img src="<?php echo plugin_dir_url( __FILE__ );?>assets/round-check.png" class="rg-small-icon"/></div>
125
  <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>
126
+ </div>
 
 
127
  <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>
128
  <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>
129
  <div style="margin: 10px;"><div class="rg-icon-thumb"><input type="radio" name="select-plan" value="promote_19" 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">$19/month</span></p></div>
131
  <div style="margin: 10px;"><div class="rg-icon-thumb"><input type="radio" name="select-plan" value="promote_149" 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">$149/month</span></p></div>
132
  <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>
133
  <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>
 
 
134
  <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>
 
135
  </div></div>
136
  </div>
137
  <?php } else { ?>
213
  </div>
214
  <?php } ?>
215
  </div>
216
+ </div>
217
  </form>
218
+
219
  <script type="text/javascript" charset="utf-8">
220
  function subscribe_readygraph() {
221
  var radios = document.getElementsByName("select-plan");
231
  break;
232
  }
233
  }
 
234
  var current_url = document.URL;
235
+ var url_array = document.URL.split( '&' );
236
+ 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');
237
+ current_url = url_array[0]+'&ac=site-profile&readygraph_plan='+plan;
 
 
 
 
238
  if (plan === "promote_free"){
239
  window.location.href = current_url;
240
  }
264
  <?php $current_url = explode("&", $_SERVER['REQUEST_URI']); ?>
265
  window.location.replace("<?php echo $current_url[0].'&popup_delay=';?>"+n.value);
266
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  </script>
268
+
269
+ <?php include("footer.php"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
extension/readygraph/customize-emails.php CHANGED
@@ -11,23 +11,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,128 +30,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
-
129
- <div class="readygraph-nav-menu">
130
- <ul><li>Grow Users
131
- <ul>
132
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
133
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
134
- <li><a href="#"></a></li>
135
- </ul>
136
- </li>
137
- <li>Email Users
138
- <ul>
139
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
140
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
141
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
142
- </ul>
143
- </li>
144
- <li>
145
- Engage Users
146
- <ul>
147
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed">Social Feed</a></li>
148
- <li><a href="#">Social Followers</a></li>
149
- <li><a href="#">Feedback Survey</a></li>
150
- </ul>
151
- </li>
152
- <li>Basic Settings
153
- <ul>
154
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
155
- <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>
156
- </ul>
157
- </li>
158
- </ul>
159
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
160
- <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
161
- </div>
162
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
163
- <p>
164
- <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>
165
- </div>
166
- <div class="btn-group" style="">
167
- <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>
168
- </div>
169
- </div>
170
  <div class="tutorial-true" style="margin: 5% auto;">
171
  <h3 style="font-weight: normal; text-align: center;">Next Step: Customize automated emails to engage your userbase</h3>
172
  <h4 style="font-weight: normal; text-align: center;">Head over to ReadyGraph.com to customize emails such as:</h4>
@@ -180,378 +48,6 @@ If you have questions or concerns contact us anytime at <a href="mailto:info@rea
180
  <a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=basic-settings" style="margin: 15px">Skip, End Tutorial</a>
181
  </div></div>
182
  </div>
183
-
184
- </div>
185
- </form>
186
- <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
187
- <script type="text/javascript" charset="utf-8">
188
- var $ = jQuery;
189
- $(function () {
190
- var settings =
191
- {
192
- 'host': "www.readygraph.com"
193
- , 'clientId': "9838eb84c6da2fc44ab9"
194
- };
195
 
196
- var authHost = "https://" + settings.host;
197
- var resourceHost = "https://" + settings.host;
198
-
199
- // OAuth 2.0 Popup
200
- //
201
- var popupWindow=null;
202
- function openPopup(url)
203
- {
204
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
205
- 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);
206
- }
207
- function parent_disable() {
208
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
209
- }
210
-
211
- $("a.connect").click(function() {
212
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
213
- openPopup(url);
214
- $(document.body).bind('focus', parent_disable);
215
- $(document.body).bind('click', parent_disable);
216
- });
217
- $(".change-account").click(function() {
218
- document.cookie="readygraph_tutorial=true"
219
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
220
- var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
221
- openPopup(logout);
222
- $(document.body).bind('focus', parent_disable);
223
- $(document.body).bind('click', parent_disable);
224
- });
225
-
226
- // User Interface
227
- //
228
- $('.template').click(function() {
229
- $('#preview').attr('src', $(this).find('img').attr('src'));
230
- });
231
-
232
- // Manage OAuth 2.0 Redirect
233
- //
234
- var extractCode = function(hash) {
235
- var match = hash.match(/code=(\w+)/);
236
- return !!match && match[1];
237
- };
238
- var extractToken = function(hash) {
239
- var match = hash.match(/access_token=(\w+)/);
240
- return !!match && match[1];
241
- };
242
- var extractError = function(hash) {
243
- var match = hash.match(/error=(\w+)/);
244
- return !!match && match[1];
245
- };
246
-
247
- var code = extractCode(window.location.href);
248
- if (extractError(window.location.href) == 'access_denied') {
249
- window.close();
250
- }
251
- else if(code) {
252
- try { window.opener.setCode(code); }
253
- catch(ex) { }
254
- window.close();
255
- }
256
- else {
257
- $('.rgw-fb-login-button-iframe').hide();
258
- $('div.authenticate').show();
259
-
260
- if ($('[name="readygraph_access_token"]').val()) {
261
- $('.rgw-fb-login-button-iframe').show();
262
- $('div.authenticate').hide();
263
- $('div.authenticating').hide();
264
- $('div.authenticated').show();
265
-
266
- $('.email-address').text($('[name="readygraph_email"]').val());
267
-
268
- window.setup_readygraph($('[name="readygraph_application_id"]').val());
269
- $('.delay').val($('[name="readygraph_delay"]').val());
270
- $('.sidebar').val($('[name="readygraph_enable_sidebar"]').val());
271
- $('.notification').val($('[name="readygraph_enable_notification"]').val());
272
- $('.selectAll').val($('[name="readygraph_auto_select_all"]').val());
273
- $('.branding').val($('[name="readygraph_enable_branding"]').val());
274
- $('.blog_updates').val($('[name="readygraph_send_blog_updates"]').val());
275
- $('.real_time_post_update').val($('[name="readygraph_send_real_time_post_updates"]').val());
276
- $('.popup_template').val($('[name="readygraph_popup_template"]').val());
277
-
278
- //$('[name="readygraph_ad_format"][value="' + $('[name="_readygraph_ad_format"]').val() + '"]').parent().click();
279
- //$('[name="readygraph_ad_timing"][value="' + $('[name="_readygraph_ad_timing"]').val() + '"]').parent().click();
280
-
281
- //$('[name="readygraph_ad_delay"]').val($('[name="_readygraph_ad_delay"]').val());
282
- //$('[name="readygraph_ad_scroll"]').val($('[name="_readygraph_ad_scroll"]').val());
283
-
284
- $('.result').text('...');
285
- if ($('[name="readygraph_access_token"]').val()) {
286
- $.ajax({
287
- url: resourceHost + '/api/v1/insight_info'
288
- , beforeSend: function (xhr) {
289
- xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
290
- xhr.setRequestHeader('Accept', "application/json");
291
- }
292
- , method: 'POST'
293
- , success: function (response) {
294
- if (response.data) {
295
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
296
- } else {
297
- $('.result').text('Insight');
298
- }
299
- }
300
- , error: function (response) {
301
- refresh_access_token();
302
- }
303
- });
304
- }
305
- }
306
- }
307
-
308
- // Manage OAuth 2.0 Results
309
- //
310
- function refresh_access_token() {
311
- var refresh_token = $('[name="readygraph_refresh_token"]').val();
312
- if (refresh_token) {
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: 'refresh_token',
321
- refresh_token: $('[name="readygraph_refresh_token"]').val(),
322
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
323
- client_id: settings.clientId
324
- }
325
- , method: 'POST'
326
- , success: function (response) {
327
- $('[name="readygraph_access_token"]').val(response.access_token);
328
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
329
- window.setAccessToken(response.access_token);
330
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
331
- }
332
- , error: function (response) {
333
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
334
- $('div.authenticate').show();
335
- $('div.authenticating').hide();
336
- $('div.authenticated').hide();
337
- }
338
- });
339
- }
340
- }
341
- window.setCode = function(code) {
342
- $('.rgw-fb-login-button-iframe').hide();
343
- $('div.authenticate').hide();
344
- $('div.authenticating').show();
345
- $('div.authenticated').hide();
346
-
347
- $.ajax({
348
- url: resourceHost + '/oauth/access_token'
349
- , data: {
350
- grant_type: 'authorization_code',
351
- code: code,
352
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
353
- client_id: settings.clientId
354
- }
355
- , method: 'POST'
356
- , success: function (response) {
357
- if (response) {
358
- $('[name="readygraph_access_token"]').val(response.access_token);
359
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
360
- window.setAccessToken(response.access_token);
361
- } else {
362
- $('div.authenticating').hide();
363
- $('div.authenticate').show();
364
- }
365
- }
366
- });
367
- }
368
- window.setAccessToken = function(token) {
369
- $('.rgw-fb-login-button-iframe').hide();
370
- $('div.authenticate').hide();
371
- $('div.authenticating').show();
372
- $('div.authenticated').hide();
373
-
374
- $.ajax({
375
- url: resourceHost + '/api/v1/account_info'
376
- , beforeSend: function (xhr) {
377
- xhr.setRequestHeader('Authorization', "Bearer " + token);
378
- xhr.setRequestHeader('Accept', "application/json");
379
- }
380
- , method: 'POST'
381
- , success: function (response) {
382
- if (response.data) {
383
- $('[name="readygraph_access_token"]').val(token);
384
- $('[name="readygraph_email"]').val(response.data.email);
385
- $('[name="readygraph_application_id"]').val(response.data.application_id);
386
- $('#myForm')[0].submit();
387
- } else {
388
- $('div.authenticating').hide();
389
- $('div.authenticate').show();
390
- $('.rgw-fb-login-button-iframe').hide();
391
- }
392
- }
393
- });
394
- }
395
- });
396
- </script>
397
- <script>
398
- window.setup = false;
399
- window.refresh_readygraph = function() {};
400
- window.setup_readygraph = function(app_id) {
401
- if (window.setup) {
402
- window.refresh_readygraph();
403
- return;
404
- }
405
- window.setup = true;
406
- readygraph.setup({
407
- applicationId: app_id,
408
- isPreview: true,
409
- enableLoginWall: false,
410
- enableDistraction: false,
411
- enableAutoLogin: false,
412
- enableSidebar: false,
413
- enableNotification: false,
414
- enableInvite: false,
415
- enableOpenGraph: false,
416
- enableRgSeo: false
417
- });
418
- readygraph.ready(function() {
419
- readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
420
- var $ = readygraph.framework.jQuery;
421
- $.cookie('RGAuth', null);
422
- readygraph.framework.facebook.logout(function() {
423
- readygraph.framework.require(['invite'], function() {
424
- var VIEW_TYPE = {
425
- LOADING: 0,
426
- LOGIN_REQUIRE: 1,
427
- PERMISSION_REQUIRE: 2,
428
- DEFAULT: 3,
429
- LOGIN_WITH_EMAIL: 4,
430
- SIGNUP_WITH_EMAIL: 5,
431
- IMPORT_WITH_EMAIL: 6,
432
- FINISH: 10
433
- };
434
-
435
- var auth = new readygraph.framework.ui.AuthModel({
436
- dialog: true,
437
- 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
438
- });
439
- $('.rg-preview-widget').html('');
440
- $('.rg-preview-widget').append(auth.lightbox.view.$el);
441
- $('.rgw-content').attr('style', 'position: relative !important;');
442
-
443
- var view = VIEW_TYPE.LOGIN_REQUIRE;
444
- auth.on('switch', function() {
445
- if (auth.view.currentView != view) { auth.view.switchView(view); }
446
- else auth.view.render();
447
- if (view == VIEW_TYPE.DEFAULT) {
448
- auth.view.$el.find('.rgw-invite-view').showAndAnimate();
449
- auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
450
- auth.view.$el.commitTransition();
451
- }
452
- });
453
- auth.view.switchView(view);
454
-
455
- $(window).scroll(function() {
456
- $(window).trigger('rgw-invalidate');
457
- });
458
- $('.rg-preview-widget, .content-warp').scroll(function() {
459
- $(window).trigger('rgw-invalidate');
460
- });
461
- $(window).trigger('rgw-invalidate');
462
-
463
- $('.rg-vertical-tab').click(function() {
464
- saveContent(auth, $('.rg-preview-widget-container'), true);
465
-
466
- $('.rg-vertical-tab').removeClass('active');
467
- $(this).addClass('active');
468
- view = VIEW_TYPE[$(this).attr('tab')];
469
- if (auth.view.currentView != view) { auth.view.switchView(view); }
470
-
471
- $('.rg-preview-widget, .content-warp').scrollTop(10000);
472
- });
473
-
474
- enableContentEditable(auth, $('.rg-preview-widget-container'));
475
- restoreContent(auth, $('.rg-preview-widget-container'));
476
-
477
- $('.save').click(function() {
478
- $('.save').css('opacity', 0.4);
479
- saveContent(auth, $('.rg-preview-widget-container'), false);
480
- });
481
-
482
- window.refresh_readygraph = function() {
483
- restoreContent(auth, $('.rg-preview-widget-container'));
484
- }
485
- });
486
- });
487
- });
488
- });
489
- }
490
- function enableContentEditable(model, container) {
491
- model.view.$el.find('[rgw-data-key]').each(function() {
492
- var element = $(this);
493
- if (element.attr('rgw-data-editable') == 'false') return;
494
-
495
- if (element.attr('editing') != null) return;
496
- container.find('.special-button-container button').attr('disabled', 'disabled');
497
- element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
498
- element.attr('editing', '1');
499
- element.css({
500
- 'border': '2px dashed orange',
501
- 'position': 'relative',
502
- 'top': '-2px',
503
- 'margin-bottom': '-4px',
504
- 'background-color': '#FAFAC5'
505
- });
506
- element.attr('contenteditable', true);
507
- element.bind('paste', function(e) {
508
- e.preventDefault();
509
- });
510
- element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
511
- });
512
- }
513
- function saveContent(model, container, fake) {
514
- var settings = {};
515
- model.view.$el.find('[rgw-data-key]').each(function() {
516
- var element = $(this);
517
- if (element.attr('rgw-data-editable') == 'false') return;
518
- settings[element.attr('rgw-data-key')] = element.text();
519
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
520
- });
521
- if (!fake) {
522
- $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
523
- $('#myForm')[0].submit();
524
- }
525
- }
526
- function restoreContent(model, container) {
527
- eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
528
- var settings = window._TEMP;
529
- if (settings) {
530
- model.view.$el.find('[rgw-data-key]').each(function() {
531
- var element = $(this);
532
- if (element.attr('rgw-data-editable') == 'false') return;
533
- element.text(settings[element.attr('rgw-data-key')]);
534
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
535
- });
536
- }
537
- }
538
- </script>
539
- <style>
540
- /* FOR INLINE WIDGET */
541
- .rgw-overlay {
542
- display: none !important;
543
- }
544
- .rgw-content-frame {
545
- left: 0 !important;
546
- top: 0 !important;
547
- position: relative !important;
548
- margin: 0 auto !important;
549
- border: solid 1px #cccccc;
550
- }
551
- .rgw-preview-warning {
552
- display: none !important;
553
- }
554
- .rgw-content {
555
- position: relative !important;
556
- }
557
- </style>
11
  * @link http://www.readygraph.com
12
  * @copyright 2014 Your Name or Company Name
13
  */
14
+ include("header.php");
 
 
 
 
 
 
 
 
 
 
 
 
15
 
 
 
 
16
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
17
  //redirect to main page
18
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
30
  }
31
  ?>
32
 
 
 
33
  <form method="post" id="myForm">
34
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
35
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
36
  <input type="hidden" name="readygraph_email" value="<?php echo get_option('readygraph_email', '') ?>">
37
  <input type="hidden" name="readygraph_application_id" value="<?php echo get_option('readygraph_application_id', '') ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  <div class="tutorial-true" style="margin: 5% auto;">
39
  <h3 style="font-weight: normal; text-align: center;">Next Step: Customize automated emails to engage your userbase</h3>
40
  <h4 style="font-weight: normal; text-align: center;">Head over to ReadyGraph.com to customize emails such as:</h4>
48
  <a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=basic-settings" style="margin: 15px">Skip, End Tutorial</a>
49
  </div></div>
50
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
+ </form>
53
+ <?php include("footer.php"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
extension/readygraph/deactivate-readygraph.php CHANGED
@@ -11,23 +11,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 +25,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,124 +42,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
 
163
- <div class="readygraph-nav-menu">
164
- <ul><li>Grow Users
165
- <ul>
166
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
167
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
168
- <li><a href="#"></a></li>
169
- </ul>
170
- </li>
171
- <li>Email Users
172
- <ul>
173
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
174
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
175
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
176
- </ul>
177
- </li>
178
- <li>
179
- Engage Users
180
- <ul>
181
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed">Social Feed</a></li>
182
- <li><a href="#">Social Followers</a></li>
183
- <li><a href="#">Feedback Survey</a></li>
184
- </ul>
185
- </li>
186
- <li>Basic Settings
187
- <ul>
188
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
189
- <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>
190
- </ul>
191
- </li>
192
- </ul>
193
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
194
- <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
195
- </div>
196
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
197
- <p>
198
- <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>
199
- </div>
200
- <div class="btn-group" style="">
201
- <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>
202
- </div>
203
- </div>
204
  <div style="margin: 0 5%">
205
  <h2>Deactivate ReadyGraph</h2>
206
  <h3> Uh oh! Are you sure you wish to deactivate ReadyGraph?</h3>
@@ -221,376 +63,5 @@ If you have questions or concerns contact us anytime at <a href="mailto:info@rea
221
  <p>&nbsp;</p>
222
  <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>
223
  </div>
224
- </div>
225
  </form>
226
- <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
227
- <script type="text/javascript" charset="utf-8">
228
- var $ = jQuery;
229
- $(function () {
230
- var settings =
231
- {
232
- 'host': "www.readygraph.com"
233
- , 'clientId': "9838eb84c6da2fc44ab9"
234
- };
235
-
236
- var authHost = "https://" + settings.host;
237
- var resourceHost = "https://" + settings.host;
238
-
239
- // OAuth 2.0 Popup
240
- //
241
- var popupWindow=null;
242
- function openPopup(url)
243
- {
244
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
245
- 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);
246
- }
247
- function parent_disable() {
248
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
249
- }
250
-
251
- $("a.connect").click(function() {
252
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
253
- openPopup(url);
254
- $(document.body).bind('focus', parent_disable);
255
- $(document.body).bind('click', parent_disable);
256
- });
257
- $(".change-account").click(function() {
258
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
259
- var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
260
- openPopup(logout);
261
- $(document.body).bind('focus', parent_disable);
262
- $(document.body).bind('click', parent_disable);
263
- });
264
-
265
- // User Interface
266
- //
267
- $('.template').click(function() {
268
- $('#preview').attr('src', $(this).find('img').attr('src'));
269
- });
270
-
271
- // Manage OAuth 2.0 Redirect
272
- //
273
- var extractCode = function(hash) {
274
- var match = hash.match(/code=(\w+)/);
275
- return !!match && match[1];
276
- };
277
- var extractToken = function(hash) {
278
- var match = hash.match(/access_token=(\w+)/);
279
- return !!match && match[1];
280
- };
281
- var extractError = function(hash) {
282
- var match = hash.match(/error=(\w+)/);
283
- return !!match && match[1];
284
- };
285
-
286
- var code = extractCode(window.location.href);
287
- if (extractError(window.location.href) == 'access_denied') {
288
- window.close();
289
- }
290
- else if(code) {
291
- try { window.opener.setCode(code); }
292
- catch(ex) { }
293
- window.close();
294
- }
295
- else {
296
- $('.rgw-fb-login-button-iframe').hide();
297
- $('div.authenticate').show();
298
-
299
- if ($('[name="readygraph_access_token"]').val()) {
300
- $('.rgw-fb-login-button-iframe').show();
301
- $('div.authenticate').hide();
302
- $('div.authenticating').hide();
303
- $('div.authenticated').show();
304
-
305
- $('.email-address').text($('[name="readygraph_email"]').val());
306
-
307
- window.setup_readygraph($('[name="readygraph_application_id"]').val());
308
- $('.delay').val($('[name="readygraph_delay"]').val());
309
- $('.sidebar').val($('[name="readygraph_enable_sidebar"]').val());
310
- $('.notification').val($('[name="readygraph_enable_notification"]').val());
311
- $('.selectAll').val($('[name="readygraph_auto_select_all"]').val());
312
- $('.branding').val($('[name="readygraph_enable_branding"]').val());
313
- $('.blog_updates').val($('[name="readygraph_send_blog_updates"]').val());
314
- $('.real_time_post_update').val($('[name="readygraph_send_real_time_post_updates"]').val());
315
- $('.popup_template').val($('[name="readygraph_popup_template"]').val());
316
-
317
- //$('[name="readygraph_ad_format"][value="' + $('[name="_readygraph_ad_format"]').val() + '"]').parent().click();
318
- //$('[name="readygraph_ad_timing"][value="' + $('[name="_readygraph_ad_timing"]').val() + '"]').parent().click();
319
-
320
- //$('[name="readygraph_ad_delay"]').val($('[name="_readygraph_ad_delay"]').val());
321
- //$('[name="readygraph_ad_scroll"]').val($('[name="_readygraph_ad_scroll"]').val());
322
-
323
- $('.result').text('...');
324
- if ($('[name="readygraph_access_token"]').val()) {
325
- $.ajax({
326
- url: resourceHost + '/api/v1/insight_info'
327
- , beforeSend: function (xhr) {
328
- xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
329
- xhr.setRequestHeader('Accept', "application/json");
330
- }
331
- , method: 'POST'
332
- , success: function (response) {
333
- if (response.data) {
334
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
335
- } else {
336
- $('.result').text('Insight');
337
- }
338
- }
339
- , error: function (response) {
340
- refresh_access_token();
341
- }
342
- });
343
- }
344
- }
345
- }
346
-
347
- // Manage OAuth 2.0 Results
348
- //
349
- function refresh_access_token() {
350
- var refresh_token = $('[name="readygraph_refresh_token"]').val();
351
- if (refresh_token) {
352
- $('div.authenticate').hide();
353
- $('div.authenticating').show();
354
- $('div.authenticated').hide();
355
-
356
- $.ajax({
357
- url: resourceHost + '/oauth/access_token'
358
- , data: {
359
- grant_type: 'refresh_token',
360
- refresh_token: $('[name="readygraph_refresh_token"]').val(),
361
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
362
- client_id: settings.clientId
363
- }
364
- , method: 'POST'
365
- , success: function (response) {
366
- $('[name="readygraph_access_token"]').val(response.access_token);
367
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
368
- window.setAccessToken(response.access_token);
369
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
370
- }
371
- , error: function (response) {
372
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
373
- $('div.authenticate').show();
374
- $('div.authenticating').hide();
375
- $('div.authenticated').hide();
376
- }
377
- });
378
- }
379
- }
380
- window.setCode = function(code) {
381
- $('.rgw-fb-login-button-iframe').hide();
382
- $('div.authenticate').hide();
383
- $('div.authenticating').show();
384
- $('div.authenticated').hide();
385
-
386
- $.ajax({
387
- url: resourceHost + '/oauth/access_token'
388
- , data: {
389
- grant_type: 'authorization_code',
390
- code: code,
391
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
392
- client_id: settings.clientId
393
- }
394
- , method: 'POST'
395
- , success: function (response) {
396
- if (response) {
397
- $('[name="readygraph_access_token"]').val(response.access_token);
398
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
399
- window.setAccessToken(response.access_token);
400
- } else {
401
- $('div.authenticating').hide();
402
- $('div.authenticate').show();
403
- }
404
- }
405
- });
406
- }
407
- window.setAccessToken = function(token) {
408
- $('.rgw-fb-login-button-iframe').hide();
409
- $('div.authenticate').hide();
410
- $('div.authenticating').show();
411
- $('div.authenticated').hide();
412
-
413
- $.ajax({
414
- url: resourceHost + '/api/v1/account_info'
415
- , beforeSend: function (xhr) {
416
- xhr.setRequestHeader('Authorization', "Bearer " + token);
417
- xhr.setRequestHeader('Accept', "application/json");
418
- }
419
- , method: 'POST'
420
- , success: function (response) {
421
- if (response.data) {
422
- $('[name="readygraph_access_token"]').val(token);
423
- $('[name="readygraph_email"]').val(response.data.email);
424
- $('[name="readygraph_application_id"]').val(response.data.application_id);
425
- $('#myForm')[0].submit();
426
- } else {
427
- $('div.authenticating').hide();
428
- $('div.authenticate').show();
429
- $('.rgw-fb-login-button-iframe').hide();
430
- }
431
- }
432
- });
433
- }
434
- });
435
- </script>
436
- <script>
437
- window.setup = false;
438
- window.refresh_readygraph = function() {};
439
- window.setup_readygraph = function(app_id) {
440
- if (window.setup) {
441
- window.refresh_readygraph();
442
- return;
443
- }
444
- window.setup = true;
445
- readygraph.setup({
446
- applicationId: app_id,
447
- isPreview: true,
448
- enableLoginWall: false,
449
- enableDistraction: false,
450
- enableAutoLogin: false,
451
- enableSidebar: false,
452
- enableNotification: false,
453
- enableInvite: false,
454
- enableOpenGraph: false,
455
- enableRgSeo: false
456
- });
457
- readygraph.ready(function() {
458
- readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
459
- var $ = readygraph.framework.jQuery;
460
- $.cookie('RGAuth', null);
461
- readygraph.framework.facebook.logout(function() {
462
- readygraph.framework.require(['invite'], function() {
463
- var VIEW_TYPE = {
464
- LOADING: 0,
465
- LOGIN_REQUIRE: 1,
466
- PERMISSION_REQUIRE: 2,
467
- DEFAULT: 3,
468
- LOGIN_WITH_EMAIL: 4,
469
- SIGNUP_WITH_EMAIL: 5,
470
- IMPORT_WITH_EMAIL: 6,
471
- FINISH: 10
472
- };
473
-
474
- var auth = new readygraph.framework.ui.AuthModel({
475
- dialog: true,
476
- 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
477
- });
478
- $('.rg-preview-widget').html('');
479
- $('.rg-preview-widget').append(auth.lightbox.view.$el);
480
- $('.rgw-content').attr('style', 'position: relative !important;');
481
-
482
- var view = VIEW_TYPE.LOGIN_REQUIRE;
483
- auth.on('switch', function() {
484
- if (auth.view.currentView != view) { auth.view.switchView(view); }
485
- else auth.view.render();
486
- if (view == VIEW_TYPE.DEFAULT) {
487
- auth.view.$el.find('.rgw-invite-view').showAndAnimate();
488
- auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
489
- auth.view.$el.commitTransition();
490
- }
491
- });
492
- auth.view.switchView(view);
493
-
494
- $(window).scroll(function() {
495
- $(window).trigger('rgw-invalidate');
496
- });
497
- $('.rg-preview-widget, .content-warp').scroll(function() {
498
- $(window).trigger('rgw-invalidate');
499
- });
500
- $(window).trigger('rgw-invalidate');
501
-
502
- $('.rg-vertical-tab').click(function() {
503
- saveContent(auth, $('.rg-preview-widget-container'), true);
504
-
505
- $('.rg-vertical-tab').removeClass('active');
506
- $(this).addClass('active');
507
- view = VIEW_TYPE[$(this).attr('tab')];
508
- if (auth.view.currentView != view) { auth.view.switchView(view); }
509
-
510
- $('.rg-preview-widget, .content-warp').scrollTop(10000);
511
- });
512
-
513
- enableContentEditable(auth, $('.rg-preview-widget-container'));
514
- restoreContent(auth, $('.rg-preview-widget-container'));
515
-
516
- $('.save').click(function() {
517
- $('.save').css('opacity', 0.4);
518
- saveContent(auth, $('.rg-preview-widget-container'), false);
519
- });
520
-
521
- window.refresh_readygraph = function() {
522
- restoreContent(auth, $('.rg-preview-widget-container'));
523
- }
524
- });
525
- });
526
- });
527
- });
528
- }
529
- function enableContentEditable(model, container) {
530
- model.view.$el.find('[rgw-data-key]').each(function() {
531
- var element = $(this);
532
- if (element.attr('rgw-data-editable') == 'false') return;
533
-
534
- if (element.attr('editing') != null) return;
535
- container.find('.special-button-container button').attr('disabled', 'disabled');
536
- element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
537
- element.attr('editing', '1');
538
- element.css({
539
- 'border': '2px dashed orange',
540
- 'position': 'relative',
541
- 'top': '-2px',
542
- 'margin-bottom': '-4px',
543
- 'background-color': '#FAFAC5'
544
- });
545
- element.attr('contenteditable', true);
546
- element.bind('paste', function(e) {
547
- e.preventDefault();
548
- });
549
- element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
550
- });
551
- }
552
- function saveContent(model, container, fake) {
553
- var settings = {};
554
- model.view.$el.find('[rgw-data-key]').each(function() {
555
- var element = $(this);
556
- if (element.attr('rgw-data-editable') == 'false') return;
557
- settings[element.attr('rgw-data-key')] = element.text();
558
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
559
- });
560
- if (!fake) {
561
- $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
562
- $('#myForm')[0].submit();
563
- }
564
- }
565
- function restoreContent(model, container) {
566
- eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
567
- var settings = window._TEMP;
568
- if (settings) {
569
- model.view.$el.find('[rgw-data-key]').each(function() {
570
- var element = $(this);
571
- if (element.attr('rgw-data-editable') == 'false') return;
572
- element.text(settings[element.attr('rgw-data-key')]);
573
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
574
- });
575
- }
576
- }
577
- </script>
578
- <style>
579
- /* FOR INLINE WIDGET */
580
- .rgw-overlay {
581
- display: none !important;
582
- }
583
- .rgw-content-frame {
584
- left: 0 !important;
585
- top: 0 !important;
586
- position: relative !important;
587
- margin: 0 auto !important;
588
- border: solid 1px #cccccc;
589
- }
590
- .rgw-preview-warning {
591
- display: none !important;
592
- }
593
- .rgw-content {
594
- position: relative !important;
595
- }
596
- </style>
11
  * @link http://www.readygraph.com
12
  * @copyright 2014 Your Name or Company Name
13
  */
14
+ include("header.php");
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
17
  //redirect to main page
18
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
25
  if (isset($_POST["readygraph_application_id"])) update_option('readygraph_application_id', $_POST["readygraph_application_id"]);
26
  if (isset($_POST["readygraph_settings"])) update_option('readygraph_settings', $_POST["readygraph_settings"]);
27
  if (isset($_POST["retentionemaileditor"])) update_option('readygraph_invite_email', $_POST["retentionemaileditor"]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
29
+ ?>
 
 
 
 
 
 
 
 
30
 
 
 
31
  <form method="post" id="myForm">
32
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
33
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
42
  <input type="hidden" name="readygraph_send_blog_updates" value="<?php echo get_option('readygraph_send_blog_updates', 'true') ?>">
43
  <input type="hidden" name="readygraph_send_real_time_post_updates" value="<?php echo get_option('readygraph_send_real_time_post_updates', 'false') ?>">
44
  <input type="hidden" name="readygraph_popup_template" value="<?php echo get_option('readygraph_popup_template', 'default-template') ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  <div style="margin: 0 5%">
47
  <h2>Deactivate ReadyGraph</h2>
48
  <h3> Uh oh! Are you sure you wish to deactivate ReadyGraph?</h3>
63
  <p>&nbsp;</p>
64
  <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>
65
  </div>
 
66
  </form>
67
+ <?php include("footer.php"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
extension/readygraph/extension.php CHANGED
@@ -1,124 +1,14 @@
1
  <?php
2
  // ReadyGraph Extension
3
  //
4
- if(!function_exists('add_s2_readygraph_plugin_warning')) {
5
- function add_s2_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;
@@ -139,24 +29,41 @@ script.onload = function(e) {
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) {
@@ -175,8 +82,4 @@ script.onload = function(e) {
175
  }
176
  h.appendChild(script);
177
  </script>
178
- <?php
179
- }
180
- }
181
- }
182
- ?>
1
  <?php
2
  // ReadyGraph Extension
3
  //
 
 
 
4
 
5
+ function s2_readygraph_client_script_head() {
6
+ if(!get_option('readygraph_application_id') && strlen(get_option('readygraph_application_id')) < 0) return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  if (get_option('readygraph_enable_branding', '') == 'false') {
8
+ echo '<style>/* FOR INLINE WIDGET */.rgw-text {display: none !important;}</style>';
9
+ }
10
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
11
+ ?>
 
 
 
 
12
  <script type='text/javascript'>
13
  var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
14
  var d = top.document;
29
  readygraph.ready(function() {
30
  readygraph.framework.require(['auth', 'invite', 'compact.sdk'], function() {
31
  function process(userInfo) {
 
 
32
  var rg_email = userInfo.get('email');
33
  var first_name = userInfo.get('first_name');
34
  var last_name = userInfo.get('last_name');
35
+ <?php if ( is_plugin_active( 'subscribe2/subscribe2.php' ) ) { ?>
 
 
36
  jQuery.post(ajaxurl,
37
  {
38
  action : 's2-myajax-submit',
39
  email : rg_email
40
+ },function(){});
41
+ <?php } ?>
42
+ <?php if ( is_plugin_active( 'email-newsletter/email-newsletter.php' ) ) { ?>
43
+ jQuery.post(ajaxurl,
44
+ {
45
+ action : 'ee-myajax-submit',
46
+ email : rg_email
47
+ },function(){});
48
+ <?php } ?>
49
+ <?php if ( is_plugin_active( 'simple-subscribe/SimpleSubsribe.php' ) ) { ?>
50
+ jQuery.post(ajaxurl,
51
+ {
52
+ action : 'ss-myajax-submit',
53
+ email : rg_email,
54
+ fname : first_name,
55
+ lname : last_name
56
+ },function(){});
57
+ <?php } ?>
58
+ <?php if ( is_plugin_active( 'simple-contact-form/simple-contact-form.php' ) ) { ?>
59
+ jQuery.post(ajaxurl,
60
+ {
61
+ action : 'gCF-myajax-submit',
62
+ email : rg_email,
63
+ name : first_name
64
+ },function(){});
65
+ <?php } ?>
66
  }
 
 
67
  }
68
  readygraph.framework.authentication.getUserInfo(function(userInfo) {
69
  if (userInfo.get('uid') != null) {
82
  }
83
  h.appendChild(script);
84
  </script>
85
+ <?php } ?>
 
 
 
 
extension/readygraph/faq.php CHANGED
@@ -11,156 +11,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
-
122
- <div class="readygraph-nav-menu">
123
- <ul><li>Grow Users
124
- <ul>
125
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
126
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
127
- <li><a href="#"></a></li>
128
- </ul>
129
- </li>
130
- <li>Email Users
131
- <ul>
132
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
133
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
134
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
135
- </ul>
136
- </li>
137
- <li>
138
- Engage Users
139
- <ul>
140
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed">Social Feed</a></li>
141
- <li><a href="#">Social Followers</a></li>
142
- <li><a href="#">Feedback Survey</a></li>
143
- </ul>
144
- </li>
145
- <li>Basic Settings
146
- <ul>
147
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
148
- <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>
149
- </ul>
150
- </li>
151
- </ul>
152
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
153
- <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
154
- </div>
155
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
156
- <p>
157
- <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>
158
- </div>
159
- <div class="btn-group" style="">
160
- <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>
161
- </div>
162
- </div>
163
-
164
  <div class="tutorial-true" style="margin: 5% auto;">
165
  <h3 style="font-weight: normal; text-align: center;">Frequenty Asked Questions</h3>
166
 
@@ -259,377 +127,5 @@ Yes, on the right side of the “ReadyGraph App” page, you will find a link to
259
  If you have questions or concerns, contact us anytime at [info@readygraph.com](mailto:info@readygraph.com)
260
  </div>
261
 
262
- </div>
263
  </form>
264
- <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
265
- <script type="text/javascript" charset="utf-8">
266
- var $ = jQuery;
267
- $(function () {
268
- var settings =
269
- {
270
- 'host': "www.readygraph.com"
271
- , 'clientId': "9838eb84c6da2fc44ab9"
272
- };
273
-
274
- var authHost = "https://" + settings.host;
275
- var resourceHost = "https://" + settings.host;
276
-
277
- // OAuth 2.0 Popup
278
- //
279
- var popupWindow=null;
280
- function openPopup(url)
281
- {
282
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
283
- 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);
284
- }
285
- function parent_disable() {
286
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
287
- }
288
-
289
- $("a.connect").click(function() {
290
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
291
- openPopup(url);
292
- $(document.body).bind('focus', parent_disable);
293
- $(document.body).bind('click', parent_disable);
294
- });
295
- $(".change-account").click(function() {
296
- document.cookie="readygraph_tutorial=true"
297
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
298
- var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
299
- openPopup(logout);
300
- $(document.body).bind('focus', parent_disable);
301
- $(document.body).bind('click', parent_disable);
302
- });
303
-
304
- // User Interface
305
- //
306
- $('.template').click(function() {
307
- $('#preview').attr('src', $(this).find('img').attr('src'));
308
- });
309
-
310
- // Manage OAuth 2.0 Redirect
311
- //
312
- var extractCode = function(hash) {
313
- var match = hash.match(/code=(\w+)/);
314
- return !!match && match[1];
315
- };
316
- var extractToken = function(hash) {
317
- var match = hash.match(/access_token=(\w+)/);
318
- return !!match && match[1];
319
- };
320
- var extractError = function(hash) {
321
- var match = hash.match(/error=(\w+)/);
322
- return !!match && match[1];
323
- };
324
-
325
- var code = extractCode(window.location.href);
326
- if (extractError(window.location.href) == 'access_denied') {
327
- window.close();
328
- }
329
- else if(code) {
330
- try { window.opener.setCode(code); }
331
- catch(ex) { }
332
- window.close();
333
- }
334
- else {
335
- $('.rgw-fb-login-button-iframe').hide();
336
- $('div.authenticate').show();
337
-
338
- if ($('[name="readygraph_access_token"]').val()) {
339
- $('.rgw-fb-login-button-iframe').show();
340
- $('div.authenticate').hide();
341
- $('div.authenticating').hide();
342
- $('div.authenticated').show();
343
-
344
- $('.email-address').text($('[name="readygraph_email"]').val());
345
-
346
- window.setup_readygraph($('[name="readygraph_application_id"]').val());
347
- $('.delay').val($('[name="readygraph_delay"]').val());
348
- $('.sidebar').val($('[name="readygraph_enable_sidebar"]').val());
349
- $('.notification').val($('[name="readygraph_enable_notification"]').val());
350
- $('.selectAll').val($('[name="readygraph_auto_select_all"]').val());
351
- $('.branding').val($('[name="readygraph_enable_branding"]').val());
352
- $('.blog_updates').val($('[name="readygraph_send_blog_updates"]').val());
353
- $('.real_time_post_update').val($('[name="readygraph_send_real_time_post_updates"]').val());
354
- $('.popup_template').val($('[name="readygraph_popup_template"]').val());
355
-
356
- //$('[name="readygraph_ad_format"][value="' + $('[name="_readygraph_ad_format"]').val() + '"]').parent().click();
357
- //$('[name="readygraph_ad_timing"][value="' + $('[name="_readygraph_ad_timing"]').val() + '"]').parent().click();
358
-
359
- //$('[name="readygraph_ad_delay"]').val($('[name="_readygraph_ad_delay"]').val());
360
- //$('[name="readygraph_ad_scroll"]').val($('[name="_readygraph_ad_scroll"]').val());
361
-
362
- $('.result').text('...');
363
- if ($('[name="readygraph_access_token"]').val()) {
364
- $.ajax({
365
- url: resourceHost + '/api/v1/insight_info'
366
- , beforeSend: function (xhr) {
367
- xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
368
- xhr.setRequestHeader('Accept', "application/json");
369
- }
370
- , method: 'POST'
371
- , success: function (response) {
372
- if (response.data) {
373
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
374
- } else {
375
- $('.result').text('Insight');
376
- }
377
- }
378
- , error: function (response) {
379
- refresh_access_token();
380
- }
381
- });
382
- }
383
- }
384
- }
385
-
386
- // Manage OAuth 2.0 Results
387
- //
388
- function refresh_access_token() {
389
- var refresh_token = $('[name="readygraph_refresh_token"]').val();
390
- if (refresh_token) {
391
- $('div.authenticate').hide();
392
- $('div.authenticating').show();
393
- $('div.authenticated').hide();
394
-
395
- $.ajax({
396
- url: resourceHost + '/oauth/access_token'
397
- , data: {
398
- grant_type: 'refresh_token',
399
- refresh_token: $('[name="readygraph_refresh_token"]').val(),
400
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
401
- client_id: settings.clientId
402
- }
403
- , method: 'POST'
404
- , success: function (response) {
405
- $('[name="readygraph_access_token"]').val(response.access_token);
406
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
407
- window.setAccessToken(response.access_token);
408
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
409
- }
410
- , error: function (response) {
411
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
412
- $('div.authenticate').show();
413
- $('div.authenticating').hide();
414
- $('div.authenticated').hide();
415
- }
416
- });
417
- }
418
- }
419
- window.setCode = function(code) {
420
- $('.rgw-fb-login-button-iframe').hide();
421
- $('div.authenticate').hide();
422
- $('div.authenticating').show();
423
- $('div.authenticated').hide();
424
-
425
- $.ajax({
426
- url: resourceHost + '/oauth/access_token'
427
- , data: {
428
- grant_type: 'authorization_code',
429
- code: code,
430
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
431
- client_id: settings.clientId
432
- }
433
- , method: 'POST'
434
- , success: function (response) {
435
- if (response) {
436
- $('[name="readygraph_access_token"]').val(response.access_token);
437
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
438
- window.setAccessToken(response.access_token);
439
- } else {
440
- $('div.authenticating').hide();
441
- $('div.authenticate').show();
442
- }
443
- }
444
- });
445
- }
446
- window.setAccessToken = function(token) {
447
- $('.rgw-fb-login-button-iframe').hide();
448
- $('div.authenticate').hide();
449
- $('div.authenticating').show();
450
- $('div.authenticated').hide();
451
-
452
- $.ajax({
453
- url: resourceHost + '/api/v1/account_info'
454
- , beforeSend: function (xhr) {
455
- xhr.setRequestHeader('Authorization', "Bearer " + token);
456
- xhr.setRequestHeader('Accept', "application/json");
457
- }
458
- , method: 'POST'
459
- , success: function (response) {
460
- if (response.data) {
461
- $('[name="readygraph_access_token"]').val(token);
462
- $('[name="readygraph_email"]').val(response.data.email);
463
- $('[name="readygraph_application_id"]').val(response.data.application_id);
464
- $('#myForm')[0].submit();
465
- } else {
466
- $('div.authenticating').hide();
467
- $('div.authenticate').show();
468
- $('.rgw-fb-login-button-iframe').hide();
469
- }
470
- }
471
- });
472
- }
473
- });
474
- </script>
475
- <script>
476
- window.setup = false;
477
- window.refresh_readygraph = function() {};
478
- window.setup_readygraph = function(app_id) {
479
- if (window.setup) {
480
- window.refresh_readygraph();
481
- return;
482
- }
483
- window.setup = true;
484
- readygraph.setup({
485
- applicationId: app_id,
486
- isPreview: true,
487
- enableLoginWall: false,
488
- enableDistraction: false,
489
- enableAutoLogin: false,
490
- enableSidebar: false,
491
- enableNotification: false,
492
- enableInvite: false,
493
- enableOpenGraph: false,
494
- enableRgSeo: false
495
- });
496
- readygraph.ready(function() {
497
- readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
498
- var $ = readygraph.framework.jQuery;
499
- $.cookie('RGAuth', null);
500
- readygraph.framework.facebook.logout(function() {
501
- readygraph.framework.require(['invite'], function() {
502
- var VIEW_TYPE = {
503
- LOADING: 0,
504
- LOGIN_REQUIRE: 1,
505
- PERMISSION_REQUIRE: 2,
506
- DEFAULT: 3,
507
- LOGIN_WITH_EMAIL: 4,
508
- SIGNUP_WITH_EMAIL: 5,
509
- IMPORT_WITH_EMAIL: 6,
510
- FINISH: 10
511
- };
512
-
513
- var auth = new readygraph.framework.ui.AuthModel({
514
- dialog: true,
515
- 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
516
- });
517
- $('.rg-preview-widget').html('');
518
- $('.rg-preview-widget').append(auth.lightbox.view.$el);
519
- $('.rgw-content').attr('style', 'position: relative !important;');
520
-
521
- var view = VIEW_TYPE.LOGIN_REQUIRE;
522
- auth.on('switch', function() {
523
- if (auth.view.currentView != view) { auth.view.switchView(view); }
524
- else auth.view.render();
525
- if (view == VIEW_TYPE.DEFAULT) {
526
- auth.view.$el.find('.rgw-invite-view').showAndAnimate();
527
- auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
528
- auth.view.$el.commitTransition();
529
- }
530
- });
531
- auth.view.switchView(view);
532
-
533
- $(window).scroll(function() {
534
- $(window).trigger('rgw-invalidate');
535
- });
536
- $('.rg-preview-widget, .content-warp').scroll(function() {
537
- $(window).trigger('rgw-invalidate');
538
- });
539
- $(window).trigger('rgw-invalidate');
540
-
541
- $('.rg-vertical-tab').click(function() {
542
- saveContent(auth, $('.rg-preview-widget-container'), true);
543
-
544
- $('.rg-vertical-tab').removeClass('active');
545
- $(this).addClass('active');
546
- view = VIEW_TYPE[$(this).attr('tab')];
547
- if (auth.view.currentView != view) { auth.view.switchView(view); }
548
-
549
- $('.rg-preview-widget, .content-warp').scrollTop(10000);
550
- });
551
-
552
- enableContentEditable(auth, $('.rg-preview-widget-container'));
553
- restoreContent(auth, $('.rg-preview-widget-container'));
554
-
555
- $('.save').click(function() {
556
- $('.save').css('opacity', 0.4);
557
- saveContent(auth, $('.rg-preview-widget-container'), false);
558
- });
559
-
560
- window.refresh_readygraph = function() {
561
- restoreContent(auth, $('.rg-preview-widget-container'));
562
- }
563
- });
564
- });
565
- });
566
- });
567
- }
568
- function enableContentEditable(model, container) {
569
- model.view.$el.find('[rgw-data-key]').each(function() {
570
- var element = $(this);
571
- if (element.attr('rgw-data-editable') == 'false') return;
572
-
573
- if (element.attr('editing') != null) return;
574
- container.find('.special-button-container button').attr('disabled', 'disabled');
575
- element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
576
- element.attr('editing', '1');
577
- element.css({
578
- 'border': '2px dashed orange',
579
- 'position': 'relative',
580
- 'top': '-2px',
581
- 'margin-bottom': '-4px',
582
- 'background-color': '#FAFAC5'
583
- });
584
- element.attr('contenteditable', true);
585
- element.bind('paste', function(e) {
586
- e.preventDefault();
587
- });
588
- element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
589
- });
590
- }
591
- function saveContent(model, container, fake) {
592
- var settings = {};
593
- model.view.$el.find('[rgw-data-key]').each(function() {
594
- var element = $(this);
595
- if (element.attr('rgw-data-editable') == 'false') return;
596
- settings[element.attr('rgw-data-key')] = element.text();
597
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
598
- });
599
- if (!fake) {
600
- $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
601
- $('#myForm')[0].submit();
602
- }
603
- }
604
- function restoreContent(model, container) {
605
- eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
606
- var settings = window._TEMP;
607
- if (settings) {
608
- model.view.$el.find('[rgw-data-key]').each(function() {
609
- var element = $(this);
610
- if (element.attr('rgw-data-editable') == 'false') return;
611
- element.text(settings[element.attr('rgw-data-key')]);
612
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
613
- });
614
- }
615
- }
616
- </script>
617
- <style>
618
- /* FOR INLINE WIDGET */
619
- .rgw-overlay {
620
- display: none !important;
621
- }
622
- .rgw-content-frame {
623
- left: 0 !important;
624
- top: 0 !important;
625
- position: relative !important;
626
- margin: 0 auto !important;
627
- border: solid 1px #cccccc;
628
- }
629
- .rgw-preview-warning {
630
- display: none !important;
631
- }
632
- .rgw-content {
633
- position: relative !important;
634
- }
635
- </style>
11
  * @link http://www.readygraph.com
12
  * @copyright 2014 Your Name or Company Name
13
  */
14
+ include("header.php");
15
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
17
  //redirect to main page
18
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
19
+ //echo '<script>window.location.replace("'.$current_url[0].'");</script>';
20
  }
21
  else {
22
 
23
  }
24
  ?>
25
 
 
 
26
  <form method="post" id="myForm">
27
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
28
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
29
  <input type="hidden" name="readygraph_email" value="<?php echo get_option('readygraph_email', '') ?>">
30
  <input type="hidden" name="readygraph_application_id" value="<?php echo get_option('readygraph_application_id', '') ?>">
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  <div class="tutorial-true" style="margin: 5% auto;">
33
  <h3 style="font-weight: normal; text-align: center;">Frequenty Asked Questions</h3>
34
 
127
  If you have questions or concerns, contact us anytime at [info@readygraph.com](mailto:info@readygraph.com)
128
  </div>
129
 
 
130
  </form>
131
+ <?php include("footer.php"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
extension/readygraph/footer.php ADDED
@@ -0,0 +1,422 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
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
+ 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;
73
+ openPopup(url);
74
+ $(document.body).bind('focus', parent_disable);
75
+ $(document.body).bind('click', parent_disable);
76
+ });
77
+ $(".change-account").click(function() {
78
+ document.cookie="readygraph_tutorial=true"
79
+ var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
80
+ var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
81
+ openPopup(logout);
82
+ $(document.body).bind('focus', parent_disable);
83
+ $(document.body).bind('click', parent_disable);
84
+ });
85
+
86
+ // User Interface
87
+ //
88
+ $('.template').click(function() {
89
+ $('#preview').attr('src', $(this).find('img').attr('src'));
90
+ });
91
+
92
+ // Manage OAuth 2.0 Redirect
93
+ //
94
+ var extractCode = function(hash) {
95
+ var match = hash.match(/code=(\w+)/);
96
+ return !!match && match[1];
97
+ };
98
+ var extractToken = function(hash) {
99
+ var match = hash.match(/access_token=(\w+)/);
100
+ return !!match && match[1];
101
+ };
102
+ var extractError = function(hash) {
103
+ var match = hash.match(/error=(\w+)/);
104
+ return !!match && match[1];
105
+ };
106
+
107
+ var code = extractCode(window.location.href);
108
+ if (extractError(window.location.href) == 'access_denied') {
109
+ window.close();
110
+ }
111
+ else if(code) {
112
+ try { window.opener.setCode(code); }
113
+ catch(ex) { }
114
+ window.close();
115
+ }
116
+ else {
117
+ $('.rgw-fb-login-button-iframe').hide();
118
+ $('div.authenticate').show();
119
+
120
+ if ($('[name="readygraph_access_token"]').val()) {
121
+ $('.rgw-fb-login-button-iframe').show();
122
+ $('div.authenticate').hide();
123
+ $('div.authenticating').hide();
124
+ $('div.authenticated').show();
125
+
126
+ $('.email-address').text($('[name="readygraph_email"]').val());
127
+
128
+ window.setup_readygraph($('[name="readygraph_application_id"]').val());
129
+ $('.popup-delay').val($('[name="readygraph_delay"]').val());
130
+ if ($('[name="readygraph_enable_popup"]').val() == "true"){
131
+ $('.signup-popup').val('yes-center');
132
+ }
133
+ else if ($('[name="readygraph_enable_notification"]').val() == "true"){
134
+ $('.signup-popup').val('yes-bottom-right');
135
+ }
136
+ else{
137
+ $('.signup-popup').val('no');
138
+ }
139
+ $('.delay').val($('[name="readygraph_delay"]').val());
140
+ $('.notification').val($('[name="readygraph_enable_notification"]').val());
141
+ $('.selectAll').val($('[name="readygraph_auto_select_all"]').val());
142
+ $('.branding').val($('[name="readygraph_enable_branding"]').val());
143
+ $('.blog_updates').val($('[name="readygraph_send_blog_updates"]').val());
144
+ $('.real_time_post_update').val($('[name="readygraph_send_real_time_post_updates"]').val());
145
+ $('.popup_template').val($('[name="readygraph_popup_template"]').val());
146
+ $('.result').text('...');
147
+ if ($('[name="readygraph_access_token"]').val()) {
148
+ $.ajax({
149
+ url: resourceHost + '/api/v1/insight_info'
150
+ , beforeSend: function (xhr) {
151
+ xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
152
+ xhr.setRequestHeader('Accept', "application/json");
153
+ }
154
+ , method: 'POST'
155
+ , success: function (response) {
156
+ if (response.data) {
157
+ $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
158
+ $('.user_tier').text(((response.data.user_tier > 0) ? ' Premium User ' : ' Free User '));
159
+
160
+ } else {
161
+ $('.result').text('Insight');
162
+ $('.result').text(' Free User ');
163
+ }
164
+ }
165
+ , error: function (response) {
166
+ refresh_access_token();
167
+ }
168
+ });
169
+ }
170
+ }
171
+ }
172
+
173
+ // Manage OAuth 2.0 Results
174
+ //
175
+ function refresh_access_token() {
176
+ var refresh_token = $('[name="readygraph_refresh_token"]').val();
177
+ if (refresh_token) {
178
+ $('div.authenticate').hide();
179
+ $('div.authenticating').show();
180
+ $('div.authenticated').hide();
181
+
182
+ $.ajax({
183
+ url: resourceHost + '/oauth/access_token'
184
+ , data: {
185
+ grant_type: 'refresh_token',
186
+ refresh_token: $('[name="readygraph_refresh_token"]').val(),
187
+ redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
188
+ client_id: settings.clientId
189
+ }
190
+ , method: 'POST'
191
+ , success: function (response) {
192
+ $('[name="readygraph_access_token"]').val(response.access_token);
193
+ $('[name="readygraph_refresh_token"]').val(response.refresh_token);
194
+ window.setAccessToken(response.access_token);
195
+ $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
196
+ }
197
+ , error: function (response) {
198
+ alert('We couldn\'t authenticate your account. Please check your internet connection.');
199
+ $('div.authenticate').show();
200
+ $('div.authenticating').hide();
201
+ $('div.authenticated').hide();
202
+ }
203
+ });
204
+ }
205
+ }
206
+ window.setCode = function(code) {
207
+ $('.rgw-fb-login-button-iframe').hide();
208
+ $('div.authenticate').hide();
209
+ $('div.authenticating').show();
210
+ $('div.authenticated').hide();
211
+
212
+ $.ajax({
213
+ url: resourceHost + '/oauth/access_token'
214
+ , data: {
215
+ grant_type: 'authorization_code',
216
+ code: code,
217
+ redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
218
+ client_id: settings.clientId
219
+ }
220
+ , method: 'POST'
221
+ , success: function (response) {
222
+ if (response) {
223
+ $('[name="readygraph_access_token"]').val(response.access_token);
224
+ $('[name="readygraph_refresh_token"]').val(response.refresh_token);
225
+ window.setAccessToken(response.access_token);
226
+ } else {
227
+ $('div.authenticating').hide();
228
+ $('div.authenticate').show();
229
+ }
230
+ }
231
+ });
232
+ }
233
+ window.setAccessToken = function(token) {
234
+ $('.rgw-fb-login-button-iframe').hide();
235
+ $('div.authenticate').hide();
236
+ $('div.authenticating').show();
237
+ $('div.authenticated').hide();
238
+
239
+ $.ajax({
240
+ url: resourceHost + '/api/v1/account_info'
241
+ , beforeSend: function (xhr) {
242
+ xhr.setRequestHeader('Authorization', "Bearer " + token);
243
+ xhr.setRequestHeader('Accept', "application/json");
244
+ }
245
+ , method: 'POST'
246
+ , success: function (response) {
247
+ if (response.data) {
248
+ $('[name="readygraph_access_token"]').val(token);
249
+ $('[name="readygraph_email"]').val(response.data.email);
250
+ $('[name="readygraph_application_id"]').val(response.data.application_id);
251
+ $('#myForm')[0].submit();
252
+ } else {
253
+ $('div.authenticating').hide();
254
+ $('div.authenticate').show();
255
+ $('.rgw-fb-login-button-iframe').hide();
256
+ }
257
+ }
258
+ });
259
+ }
260
+ });
261
+ </script>
262
+ <script>
263
+ window.setup = false;
264
+ window.refresh_readygraph = function() {};
265
+ window.setup_readygraph = function(app_id) {
266
+ if (window.setup) {
267
+ window.refresh_readygraph();
268
+ return;
269
+ }
270
+ window.setup = true;
271
+ readygraph.setup({
272
+ applicationId: app_id,
273
+ isPreview: true,
274
+ enableLoginWall: false,
275
+ enableDistraction: false,
276
+ enableAutoLogin: false,
277
+ enableSidebar: false,
278
+ enableNotification: false,
279
+ enableInvite: false,
280
+ enableOpenGraph: false,
281
+ enableRgSeo: false
282
+ });
283
+ readygraph.ready(function() {
284
+ readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
285
+ var $ = readygraph.framework.jQuery;
286
+ $.cookie('RGAuth', null);
287
+ readygraph.framework.facebook.logout(function() {
288
+ readygraph.framework.require(['invite'], function() {
289
+ var VIEW_TYPE = {
290
+ LOADING: 0,
291
+ LOGIN_REQUIRE: 1,
292
+ PERMISSION_REQUIRE: 2,
293
+ DEFAULT: 3,
294
+ LOGIN_WITH_EMAIL: 4,
295
+ SIGNUP_WITH_EMAIL: 5,
296
+ IMPORT_WITH_EMAIL: 6,
297
+ FINISH: 10
298
+ };
299
+
300
+ var auth = new readygraph.framework.ui.AuthModel({
301
+ dialog: true,
302
+ 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
303
+ });
304
+ $('.rg-preview-widget').html('');
305
+ $('.rg-preview-widget').append(auth.lightbox.view.$el);
306
+ $('.rgw-content').attr('style', 'position: relative !important;');
307
+
308
+ var view = VIEW_TYPE.LOGIN_REQUIRE;
309
+ auth.on('switch', function() {
310
+ if (auth.view.currentView != view) { auth.view.switchView(view); }
311
+ else auth.view.render();
312
+ if (view == VIEW_TYPE.DEFAULT) {
313
+ auth.view.$el.find('.rgw-invite-view').showAndAnimate();
314
+ auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
315
+ auth.view.$el.commitTransition();
316
+ }
317
+ });
318
+ auth.view.switchView(view);
319
+
320
+ $(window).scroll(function() {
321
+ $(window).trigger('rgw-invalidate');
322
+ });
323
+ $('.rg-preview-widget, .content-warp').scroll(function() {
324
+ $(window).trigger('rgw-invalidate');
325
+ });
326
+ $(window).trigger('rgw-invalidate');
327
+
328
+ $('.rg-vertical-tab').click(function() {
329
+ saveContent(auth, $('.rg-preview-widget-container'), true);
330
+
331
+ $('.rg-vertical-tab').removeClass('active');
332
+ $(this).addClass('active');
333
+ view = VIEW_TYPE[$(this).attr('tab')];
334
+ if (auth.view.currentView != view) { auth.view.switchView(view); }
335
+
336
+ $('.rg-preview-widget, .content-warp').scrollTop(10000);
337
+ });
338
+
339
+ enableContentEditable(auth, $('.rg-preview-widget-container'));
340
+ restoreContent(auth, $('.rg-preview-widget-container'));
341
+
342
+ $('.save').click(function() {
343
+ $('.save').css('opacity', 0.4);
344
+ saveContent(auth, $('.rg-preview-widget-container'), false);
345
+ });
346
+
347
+ window.refresh_readygraph = function() {
348
+ restoreContent(auth, $('.rg-preview-widget-container'));
349
+ }
350
+ });
351
+ });
352
+ });
353
+ });
354
+ }
355
+ function enableContentEditable(model, container) {
356
+ model.view.$el.find('[rgw-data-key]').each(function() {
357
+ var element = $(this);
358
+ if (element.attr('rgw-data-editable') == 'false') return;
359
+
360
+ if (element.attr('editing') != null) return;
361
+ container.find('.special-button-container button').attr('disabled', 'disabled');
362
+ element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
363
+ element.attr('editing', '1');
364
+ element.css({
365
+ 'border': '2px dashed orange',
366
+ 'position': 'relative',
367
+ 'top': '-2px',
368
+ 'margin-bottom': '-4px',
369
+ 'background-color': '#FAFAC5'
370
+ });
371
+ element.attr('contenteditable', true);
372
+ element.bind('paste', function(e) {
373
+ e.preventDefault();
374
+ });
375
+ element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
376
+ });
377
+ }
378
+ function saveContent(model, container, fake) {
379
+ var settings = {};
380
+ model.view.$el.find('[rgw-data-key]').each(function() {
381
+ var element = $(this);
382
+ if (element.attr('rgw-data-editable') == 'false') return;
383
+ settings[element.attr('rgw-data-key')] = element.text();
384
+ readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
385
+ });
386
+ if (!fake) {
387
+ $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
388
+ $('#myForm')[0].submit();
389
+ }
390
+ }
391
+ function restoreContent(model, container) {
392
+ eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
393
+ var settings = window._TEMP;
394
+ if (settings) {
395
+ model.view.$el.find('[rgw-data-key]').each(function() {
396
+ var element = $(this);
397
+ if (element.attr('rgw-data-editable') == 'false') return;
398
+ element.text(settings[element.attr('rgw-data-key')]);
399
+ readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
400
+ });
401
+ }
402
+ }
403
+ </script>
404
+ <style>
405
+ /* FOR INLINE WIDGET */
406
+ .rgw-overlay {
407
+ display: none !important;
408
+ }
409
+ .rgw-content-frame {
410
+ left: 0 !important;
411
+ top: 0 !important;
412
+ position: relative !important;
413
+ margin: 0 auto !important;
414
+ border: solid 1px #cccccc;
415
+ }
416
+ .rgw-preview-warning {
417
+ display: none !important;
418
+ }
419
+ .rgw-content {
420
+ position: relative !important;
421
+ }
422
+ </style>
extension/readygraph/functions.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
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
+ function s2_disconnectReadyGraph(){
17
+ $app_id = get_option('readygraph_application_id');
18
+ wp_remote_get( "http://readygraph.com/api/v1/tracking?event=disconnect_readygraph&app_id=$app_id" );
19
+ s2_delete_rg_options();
20
+ echo '<div class="updated"><p>We are sorry to see you go. ReadyGraph is now disconnected.</p></div>';
21
+ }
22
+ function s2_deleteReadyGraph(){
23
+ $app_id = get_option('readygraph_application_id');
24
+ update_option('readygraph_deleted', 'true');
25
+ wp_remote_get( "http://readygraph.com/api/v1/tracking?event=uninstall_readygraph&app_id=$app_id" );
26
+ s2_delete_rg_options();
27
+ $dir = plugin_dir_path( __FILE__ );
28
+ s2_rrmdir($dir);
29
+ }
30
+ function s2_readygraph_monetize_update(){
31
+ $app_id = get_option('readygraph_application_id');
32
+ $email = get_option('readygraph_monetize_email');
33
+ $monetize = get_option('readygraph_enable_monetize');
34
+ $url = 'https://readygraph.com/api/v1/wp-monetize/';
35
+ $response = wp_remote_post($url, array( 'body' => array('app_id' => $app_id, 'monetize_email' => $email, 'monetize' => $monetize)));
36
+ if ( is_wp_error( $response ) ) {
37
+ } else {
38
+ $json_decoded = json_decode($response['body'],true);
39
+ if (array_key_exists('adsoptimal_id', $json_decoded['data'])) {
40
+ update_option('readygraph_adsoptimal_id', $json_decoded['data']['adsoptimal_id']);
41
+ } if (array_key_exists('adsoptimal_secret', $json_decoded['data'])) {
42
+ update_option('readygraph_adsoptimal_secret', $json_decoded['data']['adsoptimal_secret']);
43
+ }
44
+ }
45
+ }
46
+ function s2_siteprofile_sync(){
47
+ $app_id = get_option('readygraph_application_id');
48
+ $email = get_option('readygraph_email');
49
+ $site_name = get_option('readygraph_site_name');
50
+ $site_url = get_option('readygraph_site_url');
51
+ $site_description = get_option('readygraph_site_description');
52
+ $site_category = get_option('readygraph_site_category');
53
+ $site_language = get_option('readygraph_site_language');
54
+ $url = 'https://readygraph.com/api/v1/wordpress-sync-siteprofile/';
55
+ $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)));
56
+ }
57
+
58
+ ?>
extension/readygraph/go-premium.php CHANGED
@@ -11,27 +11,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
- 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 = "admin.php?page=readygraph-app";
34
- //echo '<script>window.location.replace("'.$current_url.'");</script>';
35
  }
36
  else {
37
  if (isset($_POST["readygraph_access_token"])) update_option('readygraph_access_token', $_POST["readygraph_access_token"]);
@@ -41,18 +23,9 @@ s2_rrmdir($dir);
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
  }
44
- if (get_option('readygraph_enable_branding', '') == 'false') {
45
- ?>
46
- <style>
47
- /* FOR INLINE WIDGET */
48
- .rgw-text {
49
- display: none !important;
50
- }
51
- </style>
52
- <?php } ?>
53
 
54
- <link rel="stylesheet" type="text/css" href="<?php echo plugins_url( 'assets/css/admin.css', __FILE__ ) ?>">
55
- <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/admin.js', __FILE__ ) ?>"></script>
56
  <form method="post" id="myForm">
57
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
58
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
@@ -68,122 +41,6 @@ s2_rrmdir($dir);
68
  <input type="hidden" name="readygraph_send_real_time_post_updates" value="<?php echo get_option('readygraph_send_real_time_post_updates', 'false') ?>">
69
  <input type="hidden" name="readygraph_popup_template" value="<?php echo get_option('readygraph_popup_template', 'default-template') ?>">
70
 
71
-
72
- <div class="authenticate" style="display: none;">
73
- <div class="wrap1" style="min-height: 600px;">
74
-
75
- <div id="icon-plugins" class="icon32"></div>
76
- <h2>We've enhanced <?php echo $main_plugin_title ?> with ReadyGraph's User Growth Engine</h2>
77
-
78
- <p style="display:none;color:red;" id="error"></p>
79
- <div class="register-left">
80
- <div class="alert" style="margin: 0px auto; padding: 15px; text-align: center;">
81
- <h3>Activate ReadyGraph to get more traffic to your site</h3>
82
- <!-- <h3 style="margin-top: 0px; font-weight: 300;"><?php //echo $main_plugin_title ?>, Now with ReadyGraph</h3> -->
83
- <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>
84
- <!--<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>-->
85
- <p>Readygraph adds more ways to connect to your users. </p>
86
- <p style="text-align: left; padding: 0 20px;">
87
- - Get more traffic<br>
88
- - Send automatic email digests of all your site posts<br>
89
- - Get better deliverablility<br>
90
- - Track performace and user activity
91
- </p>
92
- </div>
93
-
94
- </div>
95
-
96
- <div class="register-right">
97
- <div class="form-wrap alert" style="font-size:12px;">
98
- <p><h3>ReadyGraph grows your site</h3></p>
99
- <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>
100
- <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 />
101
- If you have questions or concerns contact us anytime at <a href="mailto:info@readygraph.com" target="_blank">info@readygraph.com</a></p>
102
- </div>
103
- </div>
104
- </div>
105
- </div>
106
- <div class="authenticating" style="display: none;">
107
- <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;">
108
- <h3 style="margin-top: 0px; font-weight: 300;"><?php echo $main_plugin_title ?>, Now with ReadyGraph</h3>
109
- <h4 style="padding: 50px 0; line-height: 42px;">Retrieving Your Account..</h4>
110
- <p>Activate Readygraph features to optimize <?php echo $main_plugin_title ?> functionality. Signup For These Benefits:</p>
111
- <p style="text-align: left; padding: 0 20px;">
112
- - Grow your subscribers faster<br>
113
- - Engage users with automated email updates<br>
114
- - Enhanced email deliverablility<br>
115
- - Track performace with user-activity analytics
116
- </p>
117
- </div>
118
- </div>
119
- <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>
120
- <div class="authenticated" style="display: none;">
121
- <div style="background-color: #2961cb; min-width: 90%; height: 50px;margin-right: 1%;">
122
- <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/white-logo.png" style="width: 138px; height: 30px; margin: 10px 0 0 15px; float: left;">
123
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
124
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
125
- <span class="email-address" style="text-shadow: none;"></span> <span class="caret"></span>
126
- </button>
127
- <ul class="dropdown-menu">
128
- <li><a class="change-account" href="#">Change Account</a></li>
129
- <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>
130
- <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>
131
- </ul>
132
- </div>
133
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
134
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
135
- <span class="result" style="text-shadow: none;">...</span> <span class="caret"></span>
136
- </button>
137
- <ul class="dropdown-menu">
138
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Insights</a></li>
139
- </ul>
140
- </div>
141
- <div style="clear: both;"></div>
142
- </div>
143
- <!-- write menu code-->
144
-
145
- <div class="readygraph-nav-menu">
146
- <ul><li>Grow Users
147
- <ul>
148
- <li><a href="<?php $current_url = explode("?", $_SERVER['REQUEST_URI']); echo $current_url[0];?>?page=readygraph-app&ac=signup-popup">Signup Popup</a></li>
149
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
150
- <li><a href="#"></a></li>
151
- </ul>
152
- </li>
153
- <li>Email Users
154
- <ul>
155
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
156
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
157
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
158
- </ul>
159
- </li>
160
- <li>
161
- Engage Users
162
- <ul>
163
- <li><a href="<?php $current_url = explode("?", $_SERVER['REQUEST_URI']); echo $current_url[0];?>?page=readygraph-app&ac=social-feed">Social Feed</a></li>
164
- <li><a href="#">Social Followers</a></li>
165
- <li><a href="#">Feedback Survey</a></li>
166
- </ul>
167
- </li>
168
- <li>Basic Settings
169
- <ul>
170
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
171
- <li><a href="<?php $current_url = explode("?", $_SERVER['REQUEST_URI']); echo $current_url[0];?>?page=readygraph-app&ac=feature-settings">Feature Settings</a></li>
172
- <li><a href="<?php $current_url = explode("?", $_SERVER['REQUEST_URI']); echo $current_url[0];?>?page=readygraph-app&ac=monetization-settings">Monetization Settings</a></li>
173
- </ul>
174
- </li>
175
- </ul>
176
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
177
- <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
178
- </div>
179
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
180
- <p>
181
- <a href="<?php $current_url = explode("?", $_SERVER['REQUEST_URI']); echo $current_url[0];?>?page=readygraph-app&ac=faq" style="color: #b1c1ca" >FAQ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/10.png" /></a></p>
182
- </div>
183
- <div class="btn-group" style="">
184
- <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>
185
- </div>
186
- </div>
187
  <div style="margin: 3% 5%">
188
  <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/15.png" style="float: right;margin-left: 10%;" width="310px" height="350px">
189
  <h3><strong>Effortlessly Increase Your Site's Userbase</strong></h3>
@@ -214,376 +71,6 @@ If you have questions or concerns contact us anytime at <a href="mailto:info@rea
214
  <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>
215
 
216
  </div>
217
- </div>
218
- </form>
219
- <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
220
- <script type="text/javascript" charset="utf-8">
221
- var $ = jQuery;
222
- $(function () {
223
- var settings =
224
- {
225
- 'host': "www.readygraph.com"
226
- , 'clientId': "9838eb84c6da2fc44ab9"
227
- };
228
 
229
- var authHost = "https://" + settings.host;
230
- var resourceHost = "https://" + settings.host;
231
-
232
- // OAuth 2.0 Popup
233
- //
234
- var popupWindow=null;
235
- function openPopup(url)
236
- {
237
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
238
- 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);
239
- }
240
- function parent_disable() {
241
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
242
- }
243
-
244
- $("a.connect").click(function() {
245
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
246
- openPopup(url);
247
- $(document.body).bind('focus', parent_disable);
248
- $(document.body).bind('click', parent_disable);
249
- });
250
- $(".change-account").click(function() {
251
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
252
- var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
253
- openPopup(logout);
254
- $(document.body).bind('focus', parent_disable);
255
- $(document.body).bind('click', parent_disable);
256
- });
257
-
258
- // User Interface
259
- //
260
- $('.template').click(function() {
261
- $('#preview').attr('src', $(this).find('img').attr('src'));
262
- });
263
-
264
- // Manage OAuth 2.0 Redirect
265
- //
266
- var extractCode = function(hash) {
267
- var match = hash.match(/code=(\w+)/);
268
- return !!match && match[1];
269
- };
270
- var extractToken = function(hash) {
271
- var match = hash.match(/access_token=(\w+)/);
272
- return !!match && match[1];
273
- };
274
- var extractError = function(hash) {
275
- var match = hash.match(/error=(\w+)/);
276
- return !!match && match[1];
277
- };
278
-
279
- var code = extractCode(window.location.href);
280
- if (extractError(window.location.href) == 'access_denied') {
281
- window.close();
282
- }
283
- else if(code) {
284
- try { window.opener.setCode(code); }
285
- catch(ex) { }
286
- window.close();
287
- }
288
- else {
289
- $('.rgw-fb-login-button-iframe').hide();
290
- $('div.authenticated').show();
291
-
292
- if ($('[name="readygraph_access_token"]').val()) {
293
- $('.rgw-fb-login-button-iframe').show();
294
- $('div.authenticate').hide();
295
- $('div.authenticating').hide();
296
- $('div.authenticated').show();
297
-
298
- $('.email-address').text($('[name="readygraph_email"]').val());
299
-
300
- window.setup_readygraph($('[name="readygraph_application_id"]').val());
301
- $('.delay').val($('[name="readygraph_delay"]').val());
302
- $('.sidebar').val($('[name="readygraph_enable_sidebar"]').val());
303
- $('.notification').val($('[name="readygraph_enable_notification"]').val());
304
- $('.selectAll').val($('[name="readygraph_auto_select_all"]').val());
305
- $('.branding').val($('[name="readygraph_enable_branding"]').val());
306
- $('.blog_updates').val($('[name="readygraph_send_blog_updates"]').val());
307
- $('.real_time_post_update').val($('[name="readygraph_send_real_time_post_updates"]').val());
308
- $('.popup_template').val($('[name="readygraph_popup_template"]').val());
309
-
310
- //$('[name="readygraph_ad_format"][value="' + $('[name="_readygraph_ad_format"]').val() + '"]').parent().click();
311
- //$('[name="readygraph_ad_timing"][value="' + $('[name="_readygraph_ad_timing"]').val() + '"]').parent().click();
312
-
313
- //$('[name="readygraph_ad_delay"]').val($('[name="_readygraph_ad_delay"]').val());
314
- //$('[name="readygraph_ad_scroll"]').val($('[name="_readygraph_ad_scroll"]').val());
315
-
316
- $('.result').text('...');
317
- if ($('[name="readygraph_access_token"]').val()) {
318
- $.ajax({
319
- url: resourceHost + '/api/v1/insight_info'
320
- , beforeSend: function (xhr) {
321
- xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
322
- xhr.setRequestHeader('Accept', "application/json");
323
- }
324
- , method: 'POST'
325
- , success: function (response) {
326
- if (response.data) {
327
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
328
- } else {
329
- $('.result').text('Insight');
330
- }
331
- }
332
- , error: function (response) {
333
- refresh_access_token();
334
- }
335
- });
336
- }
337
- }
338
- }
339
-
340
- // Manage OAuth 2.0 Results
341
- //
342
- function refresh_access_token() {
343
- var refresh_token = $('[name="readygraph_refresh_token"]').val();
344
- if (refresh_token) {
345
- $('div.authenticate').hide();
346
- $('div.authenticating').show();
347
- $('div.authenticated').hide();
348
-
349
- $.ajax({
350
- url: resourceHost + '/oauth/access_token'
351
- , data: {
352
- grant_type: 'refresh_token',
353
- refresh_token: $('[name="readygraph_refresh_token"]').val(),
354
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
355
- client_id: settings.clientId
356
- }
357
- , method: 'POST'
358
- , success: function (response) {
359
- $('[name="readygraph_access_token"]').val(response.access_token);
360
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
361
- window.setAccessToken(response.access_token);
362
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
363
- }
364
- , error: function (response) {
365
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
366
- $('div.authenticate').show();
367
- $('div.authenticating').hide();
368
- $('div.authenticated').hide();
369
- }
370
- });
371
- }
372
- }
373
- window.setCode = function(code) {
374
- $('.rgw-fb-login-button-iframe').hide();
375
- $('div.authenticate').hide();
376
- $('div.authenticating').show();
377
- $('div.authenticated').hide();
378
-
379
- $.ajax({
380
- url: resourceHost + '/oauth/access_token'
381
- , data: {
382
- grant_type: 'authorization_code',
383
- code: code,
384
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
385
- client_id: settings.clientId
386
- }
387
- , method: 'POST'
388
- , success: function (response) {
389
- if (response) {
390
- $('[name="readygraph_access_token"]').val(response.access_token);
391
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
392
- window.setAccessToken(response.access_token);
393
- } else {
394
- $('div.authenticating').hide();
395
- $('div.authenticate').show();
396
- }
397
- }
398
- });
399
- }
400
- window.setAccessToken = function(token) {
401
- $('.rgw-fb-login-button-iframe').hide();
402
- $('div.authenticate').hide();
403
- $('div.authenticating').show();
404
- $('div.authenticated').hide();
405
-
406
- $.ajax({
407
- url: resourceHost + '/api/v1/account_info'
408
- , beforeSend: function (xhr) {
409
- xhr.setRequestHeader('Authorization', "Bearer " + token);
410
- xhr.setRequestHeader('Accept', "application/json");
411
- }
412
- , method: 'POST'
413
- , success: function (response) {
414
- if (response.data) {
415
- $('[name="readygraph_access_token"]').val(token);
416
- $('[name="readygraph_email"]').val(response.data.email);
417
- $('[name="readygraph_application_id"]').val(response.data.application_id);
418
- $('#myForm')[0].submit();
419
- } else {
420
- $('div.authenticating').hide();
421
- $('div.authenticate').show();
422
- $('.rgw-fb-login-button-iframe').hide();
423
- }
424
- }
425
- });
426
- }
427
- });
428
- </script>
429
- <script>
430
- window.setup = false;
431
- window.refresh_readygraph = function() {};
432
- window.setup_readygraph = function(app_id) {
433
- if (window.setup) {
434
- window.refresh_readygraph();
435
- return;
436
- }
437
- window.setup = true;
438
- readygraph.setup({
439
- applicationId: app_id,
440
- isPreview: true,
441
- enableLoginWall: false,
442
- enableDistraction: false,
443
- enableAutoLogin: false,
444
- enableSidebar: false,
445
- enableNotification: false,
446
- enableInvite: false,
447
- enableOpenGraph: false,
448
- enableRgSeo: false
449
- });
450
- readygraph.ready(function() {
451
- readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
452
- var $ = readygraph.framework.jQuery;
453
- $.cookie('RGAuth', null);
454
- readygraph.framework.facebook.logout(function() {
455
- readygraph.framework.require(['invite'], function() {
456
- var VIEW_TYPE = {
457
- LOADING: 0,
458
- LOGIN_REQUIRE: 1,
459
- PERMISSION_REQUIRE: 2,
460
- DEFAULT: 3,
461
- LOGIN_WITH_EMAIL: 4,
462
- SIGNUP_WITH_EMAIL: 5,
463
- IMPORT_WITH_EMAIL: 6,
464
- FINISH: 10
465
- };
466
-
467
- var auth = new readygraph.framework.ui.AuthModel({
468
- dialog: true,
469
- 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
470
- });
471
- $('.rg-preview-widget').html('');
472
- $('.rg-preview-widget').append(auth.lightbox.view.$el);
473
- $('.rgw-content').attr('style', 'position: relative !important;');
474
-
475
- var view = VIEW_TYPE.LOGIN_REQUIRE;
476
- auth.on('switch', function() {
477
- if (auth.view.currentView != view) { auth.view.switchView(view); }
478
- else auth.view.render();
479
- if (view == VIEW_TYPE.DEFAULT) {
480
- auth.view.$el.find('.rgw-invite-view').showAndAnimate();
481
- auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
482
- auth.view.$el.commitTransition();
483
- }
484
- });
485
- auth.view.switchView(view);
486
-
487
- $(window).scroll(function() {
488
- $(window).trigger('rgw-invalidate');
489
- });
490
- $('.rg-preview-widget, .content-warp').scroll(function() {
491
- $(window).trigger('rgw-invalidate');
492
- });
493
- $(window).trigger('rgw-invalidate');
494
-
495
- $('.rg-vertical-tab').click(function() {
496
- saveContent(auth, $('.rg-preview-widget-container'), true);
497
-
498
- $('.rg-vertical-tab').removeClass('active');
499
- $(this).addClass('active');
500
- view = VIEW_TYPE[$(this).attr('tab')];
501
- if (auth.view.currentView != view) { auth.view.switchView(view); }
502
-
503
- $('.rg-preview-widget, .content-warp').scrollTop(10000);
504
- });
505
-
506
- enableContentEditable(auth, $('.rg-preview-widget-container'));
507
- restoreContent(auth, $('.rg-preview-widget-container'));
508
-
509
- $('.save').click(function() {
510
- $('.save').css('opacity', 0.4);
511
- saveContent(auth, $('.rg-preview-widget-container'), false);
512
- });
513
-
514
- window.refresh_readygraph = function() {
515
- restoreContent(auth, $('.rg-preview-widget-container'));
516
- }
517
- });
518
- });
519
- });
520
- });
521
- }
522
- function enableContentEditable(model, container) {
523
- model.view.$el.find('[rgw-data-key]').each(function() {
524
- var element = $(this);
525
- if (element.attr('rgw-data-editable') == 'false') return;
526
-
527
- if (element.attr('editing') != null) return;
528
- container.find('.special-button-container button').attr('disabled', 'disabled');
529
- element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
530
- element.attr('editing', '1');
531
- element.css({
532
- 'border': '2px dashed orange',
533
- 'position': 'relative',
534
- 'top': '-2px',
535
- 'margin-bottom': '-4px',
536
- 'background-color': '#FAFAC5'
537
- });
538
- element.attr('contenteditable', true);
539
- element.bind('paste', function(e) {
540
- e.preventDefault();
541
- });
542
- element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
543
- });
544
- }
545
- function saveContent(model, container, fake) {
546
- var settings = {};
547
- model.view.$el.find('[rgw-data-key]').each(function() {
548
- var element = $(this);
549
- if (element.attr('rgw-data-editable') == 'false') return;
550
- settings[element.attr('rgw-data-key')] = element.text();
551
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
552
- });
553
- if (!fake) {
554
- $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
555
- $('#myForm')[0].submit();
556
- }
557
- }
558
- function restoreContent(model, container) {
559
- eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
560
- var settings = window._TEMP;
561
- if (settings) {
562
- model.view.$el.find('[rgw-data-key]').each(function() {
563
- var element = $(this);
564
- if (element.attr('rgw-data-editable') == 'false') return;
565
- element.text(settings[element.attr('rgw-data-key')]);
566
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
567
- });
568
- }
569
- }
570
- </script>
571
- <style>
572
- /* FOR INLINE WIDGET */
573
- .rgw-overlay {
574
- display: none !important;
575
- }
576
- .rgw-content-frame {
577
- left: 0 !important;
578
- top: 0 !important;
579
- position: relative !important;
580
- margin: 0 auto !important;
581
- border: solid 1px #cccccc;
582
- }
583
- .rgw-preview-warning {
584
- display: none !important;
585
- }
586
- .rgw-content {
587
- position: relative !important;
588
- }
589
- </style>
11
  * @link http://www.readygraph.com
12
  * @copyright 2014 Your Name or Company Name
13
  */
14
+ include("header.php");
 
 
 
 
 
 
 
 
 
 
 
 
15
 
 
 
 
16
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
 
 
 
17
  }
18
  else {
19
  if (isset($_POST["readygraph_access_token"])) update_option('readygraph_access_token', $_POST["readygraph_access_token"]);
23
  if (isset($_POST["readygraph_settings"])) update_option('readygraph_settings', $_POST["readygraph_settings"]);
24
  if (isset($_POST["retentionemaileditor"])) update_option('readygraph_invite_email', $_POST["retentionemaileditor"]);
25
  }
26
+ ?>
27
+
 
 
 
 
 
 
 
28
 
 
 
29
  <form method="post" id="myForm">
30
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
31
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
41
  <input type="hidden" name="readygraph_send_real_time_post_updates" value="<?php echo get_option('readygraph_send_real_time_post_updates', 'false') ?>">
42
  <input type="hidden" name="readygraph_popup_template" value="<?php echo get_option('readygraph_popup_template', 'default-template') ?>">
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  <div style="margin: 3% 5%">
45
  <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/15.png" style="float: right;margin-left: 10%;" width="310px" height="350px">
46
  <h3><strong>Effortlessly Increase Your Site's Userbase</strong></h3>
71
  <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>
72
 
73
  </div>
 
 
 
 
 
 
 
 
 
 
 
74
 
75
+ </form>
76
+ <?php include("footer.php"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
extension/readygraph/header.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Represents the view for the administration dashboard.
4
+ *
5
+ * This includes the header, options, and other information that should provide
6
+ * The User Interface to the end user.
7
+ *
8
+ * @package ReadyGraph
9
+ * @author dan@readygraph.com
10
+ * @license GPL-2.0+
11
+ * @link http://www.readygraph.com
12
+ * @copyright 2014 Your Name or Company Name
13
+ */
14
+ include("functions.php");
15
+ if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "changeaccount")s2_disconnectReadyGraph();
16
+ if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "deleteaccount")s2_deleteReadyGraph();
17
+ if(isset($_GET["readygraph_upgrade_notice"]) && $_GET["readygraph_upgrade_notice"] == "dismiss") {update_option('readygraph_upgrade_notice', 'false');}
18
+ global $s2_main_plugin_title;
19
+ if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
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["readygraph_delay"])) update_option('readygraph_delay', 10000);
26
+ if (isset($_POST["readygraph_enable_notification"])) update_option('readygraph_enable_notification', 'true');
27
+ if (isset($_POST["readygraph_enable_popup"])) update_option('readygraph_enable_popup', 'true');
28
+ update_option('readygraph_enable_sidebar', 'false');
29
+ update_option('readygraph_auto_select_all', 'true');
30
+ update_option('readygraph_enable_branding', 'false');
31
+ update_option('readygraph_send_blog_updates', 'true');
32
+ update_option('readygraph_send_real_time_post_updates', 'false');
33
+ update_option('readygraph_popup_template', 'default-template');
34
+ update_option('readygraph_upgrade_notice', 'true');
35
+ update_option('readygraph_tutorial',"true");
36
+ $site_url = site_url();
37
+ update_option('readygraph_site_url', $site_url);
38
+ } else {
39
+ }
40
+ ?>
41
+ <link rel="stylesheet" type="text/css" href="<?php echo plugins_url( 'assets/css/admin.css', __FILE__ ) ?>">
42
+ <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>
43
+ <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/admin.js', __FILE__ ) ?>"></script>
44
+ <?php if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) { ?>
45
+ <div class="readygraph-nav-menu">
46
+ <ul><li style="width: 200px;"><a style="color:#D5DEE4" href="<?php $current_url = explode("?", $_SERVER['REQUEST_URI']); echo $current_url[0];?>?page=s2_settings">Subscribe2 Settings</a>
47
+ </li>
48
+ <li style="width: 200px;color:#D5DEE4"><a style="color:#D5DEE4" href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=monetization-settings">Monetization Settings</a></li>
49
+ </ul>
50
+ <div class="btn-group" style="margin: 8px 10px 0 10px;">
51
+ <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
52
+ </div>
53
+ <div class="btn-group" style="margin: 8px 10px 0 10px;">
54
+ <p>
55
+ <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>
56
+ </div>
57
+ <div class="btn-group" style="">
58
+ <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>
59
+ </div>
60
+ </div>
61
+ <?php }else { ?>
62
+ <div style="background-color: #2691CB; min-width: 90%; height: 50px;margin-right: 1%;">
63
+ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/white-logo.png" style="width: 138px; height: 30px; margin: 10px 0 0 15px; float: left;">
64
+ <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
65
+ <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
66
+ <span class="email-address" style="text-shadow: none;"></span> <span class="caret"></span>
67
+ </button>
68
+ <ul class="dropdown-menu">
69
+ <li><a class="change-account" href="#">Change Account</a></li>
70
+ <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>
71
+ <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>
72
+ </ul>
73
+ </div>
74
+ <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
75
+ <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
76
+ <span class="result" style="text-shadow: none;">...</span> <span class="caret"></span>
77
+ </button>
78
+ <ul class="dropdown-menu">
79
+ <li><a href="http://readygraph.com/application/insights/" target="_blank">Insights</a></li>
80
+ </ul>
81
+ </div>
82
+ <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
83
+ <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
84
+ <span class="user_tier" style="text-shadow: none;">...</span>
85
+ </button>
86
+ </div>
87
+ <div style="clear: both;"></div>
88
+ </div>
89
+ <!-- write menu code-->
90
+
91
+ <div class="readygraph-nav-menu">
92
+
93
+ <ul><li>Grow Users
94
+ <ul>
95
+ <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
96
+ <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
97
+ <li><a href="#"></a></li>
98
+ </ul>
99
+ </li>
100
+ <li>Email Users
101
+ <ul>
102
+ <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
103
+ <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
104
+ <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
105
+ </ul>
106
+ </li>
107
+ <li>
108
+ Engage Users
109
+ <ul>
110
+ <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed">Social Feed</a></li>
111
+ <li><a href="#">Social Followers</a></li>
112
+ <li><a href="#">Feedback Survey</a></li>
113
+ </ul>
114
+ </li>
115
+ <li>Basic Settings
116
+ <ul>
117
+ <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
118
+ <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=feature-settings">Feature Settings</a></li>
119
+ <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=monetization-settings">Monetization Settings</a></li>
120
+ </ul>
121
+ </li>
122
+ </ul>
123
+
124
+ <div class="btn-group" style="margin: 8px 10px 0 10px;">
125
+ <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
126
+ </div>
127
+ <div class="btn-group" style="margin: 8px 10px 0 10px;">
128
+ <p>
129
+ <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>
130
+ </div>
131
+ <div class="btn-group" style="">
132
+ <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>
133
+ </div>
134
+ </div>
135
+ <? } ?>
extension/readygraph/monetization.php CHANGED
@@ -11,39 +11,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
- function readygraph_monetize_update(){
28
- $app_id = get_option('readygraph_application_id');
29
- $email = get_option('readygraph_monetize_email');
30
- $monetize = get_option('readygraph_enable_monetize');
31
- $related_tags = get_option('readygraph_related_tags');
32
- $url = 'https://readygraph.com/api/v1/wp-monetize/';
33
- $response = wp_remote_post($url, array( 'body' => array('app_id' => $app_id, 'monetize_email' => $email, 'monetize' => $monetize, 'related_tags' => $related_tags)));
34
- if ( is_wp_error( $response ) ) {
35
- } else {
36
- $json_decoded = json_decode($response['body'],true);
37
- if (array_key_exists('adsoptimal_id', $json_decoded['data'])) {
38
- update_option('readygraph_adsoptimal_id', $json_decoded['data']['adsoptimal_id']);
39
- } if (array_key_exists('adsoptimal_secret', $json_decoded['data'])) {
40
- update_option('readygraph_adsoptimal_secret', $json_decoded['data']['adsoptimal_secret']);
41
- }
42
- }
43
- }
44
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "changeaccount")s2_disconnectReadyGraph();
45
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "deleteaccount")s2_deleteReadyGraph();
46
- global $main_plugin_title;
47
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
48
  }
49
  else {
@@ -55,23 +25,11 @@ function readygraph_monetize_update(){
55
  if ($_SERVER['REQUEST_METHOD'] === 'POST') {
56
  if (isset($_POST["readygraph_monetize"]) && $_POST["readygraph_monetize"] == "1") update_option('readygraph_enable_monetize', "true");
57
  else update_option('readygraph_enable_monetize', "false");
58
- if (isset($_POST["readygraph_related_tags"]) && $_POST["readygraph_related_tags"] == "1") update_option('readygraph_related_tags', "true");
59
- else update_option('readygraph_related_tags', "false");
60
  if (isset($_POST["readygraph_monetize_email"])) update_option('readygraph_monetize_email', $_POST["readygraph_monetize_email"]);
61
- readygraph_monetize_update();
62
  }
63
- if (get_option('readygraph_enable_branding', '') == 'false') {
64
- ?>
65
- <style>
66
- /* FOR INLINE WIDGET */
67
- .rgw-text {
68
- display: none !important;
69
- }
70
- </style>
71
- <?php } ?>
72
 
73
- <link rel="stylesheet" type="text/css" href="<?php echo plugins_url( 'assets/css/admin.css', __FILE__ ) ?>">
74
- <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/admin.js', __FILE__ ) ?>"></script>
75
  <form method="post" id="myForm">
76
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
77
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
@@ -87,125 +45,8 @@ function readygraph_monetize_update(){
87
  <input type="hidden" name="readygraph_send_real_time_post_updates" value="<?php echo get_option('readygraph_send_real_time_post_updates', 'false') ?>">
88
  <input type="hidden" name="readygraph_popup_template" value="<?php echo get_option('readygraph_popup_template', 'default-template') ?>">
89
 
90
-
91
- <div class="authenticate" style="display: none;">
92
- <div class="wrap1" style="min-height: 600px;">
93
-
94
- <div id="icon-plugins" class="icon32"></div>
95
- <h2>Earn Revenue with <?php echo $main_plugin_title ?>'s with ReadyGraph Growth Engine</h2>
96
-
97
- <p style="display:none;color:red;" id="error"></p>
98
- <div class="register-left">
99
- <div class="alert" style="margin: 0px auto; padding: 15px; text-align: center;">
100
- <h3>Activate ReadyGraph to get more traffic to your site</h3>
101
- <!-- <h3 style="margin-top: 0px; font-weight: 300;"><?php //echo $main_plugin_title ?>, Now with ReadyGraph</h3> -->
102
- <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;">Start Earning Revenue<br><span style="font-size: 10px;">Connect ReadyGraph</span></a></p>
103
- <!--<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>-->
104
- <p>Readygraph maximizes your Growth and Revenue</p>
105
- <p style="text-align: left; padding: 0 20px;">
106
- - Monetize mobile and web traffic with optimized, non-intrusive ad units<br>
107
- - Get more traffic<br>
108
- - Send automatic email digests of all your site posts<br>
109
- - Get better deliverablility<br>
110
- - Track performace and user activity
111
- </p>
112
- </div>
113
-
114
- </div>
115
-
116
- <div class="register-right">
117
- <div class="form-wrap alert" style="font-size:12px;">
118
- <p><h3>ReadyGraph grows your site</h3></p>
119
- <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>
120
- <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 />
121
- If you have questions or concerns contact us anytime at <a href="mailto:info@readygraph.com" target="_blank">info@readygraph.com</a></p>
122
- </div>
123
- </div>
124
- </div>
125
- </div>
126
- <div class="authenticating" style="display: none;">
127
- <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;">
128
- <h3 style="margin-top: 0px; font-weight: 300;"><?php echo $main_plugin_title ?>, Now with ReadyGraph</h3>
129
- <h4 style="padding: 50px 0; line-height: 42px;">Retrieving Your Account..</h4>
130
- <p>Activate Readygraph features to optimize <?php echo $main_plugin_title ?> functionality. Signup For These Benefits:</p>
131
- <p style="text-align: left; padding: 0 20px;">
132
- - Grow your subscribers faster<br>
133
- - Engage users with automated email updates<br>
134
- - Enhanced email deliverablility<br>
135
- - Track performace with user-activity analytics
136
- </p>
137
- </div>
138
- </div>
139
- <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>
140
- <div class="authenticated" style="display: none;">
141
- <div style="background-color: #2961cb; min-width: 90%; height: 50px;margin-right: 1%;">
142
- <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/white-logo.png" style="width: 138px; height: 30px; margin: 10px 0 0 15px; float: left;">
143
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
144
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
145
- <span class="email-address" style="text-shadow: none;"></span> <span class="caret"></span>
146
- </button>
147
- <ul class="dropdown-menu">
148
- <li><a class="change-account" href="#">Change Account</a></li>
149
- <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>
150
- <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>
151
- </ul>
152
- </div>
153
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
154
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
155
- <span class="result" style="text-shadow: none;">...</span> <span class="caret"></span>
156
- </button>
157
- <ul class="dropdown-menu">
158
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Insights</a></li>
159
- </ul>
160
- </div>
161
- <div style="clear: both;"></div>
162
- </div>
163
- <!-- write menu code-->
164
-
165
- <div class="readygraph-nav-menu">
166
- <ul><li>Grow Users
167
- <ul>
168
- <li><a href="<?php $current_url = explode("?", $_SERVER['REQUEST_URI']); echo $current_url[0];?>?page=readygraph-app&ac=signup-popup">Signup Popup</a></li>
169
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
170
- <li><a href="#"></a></li>
171
- </ul>
172
- </li>
173
- <li>Email Users
174
- <ul>
175
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
176
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
177
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
178
- </ul>
179
- </li>
180
- <li>
181
- Engage Users
182
- <ul>
183
- <li><a href="<?php $current_url = explode("?", $_SERVER['REQUEST_URI']); echo $current_url[0];?>?page=readygraph-app&ac=social-feed">Social Feed</a></li>
184
- <li><a href="#">Social Followers</a></li>
185
- <li><a href="#">Feedback Survey</a></li>
186
- </ul>
187
- </li>
188
- <li>Basic Settings
189
- <ul>
190
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
191
- <li><a href="<?php $current_url = explode("?", $_SERVER['REQUEST_URI']); echo $current_url[0];?>?page=readygraph-app&ac=feature-settings">Feature Settings</a></li>
192
- <li><a href="<?php $current_url = explode("?", $_SERVER['REQUEST_URI']); echo $current_url[0];?>?page=readygraph-app&ac=monetization-settings">Monetization Settings</a></li>
193
- </ul>
194
- </li>
195
- </ul>
196
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
197
- <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
198
- </div>
199
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
200
- <p>
201
- <a href="<?php $current_url = explode("?", $_SERVER['REQUEST_URI']); echo $current_url[0];?>?page=readygraph-app&ac=faq" style="color: #b1c1ca" >FAQ <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/10.png" /></a></p>
202
- </div>
203
- <div class="btn-group" style="">
204
- <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>
205
- </div>
206
- </div>
207
  <div style="margin: 3% 5%">
208
- <?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 $main_plugin_title; ?>'s ReadyGraph monetization engine is now active.</h3><?php } ?>
209
  <h3><strong>Adjust Revenue Settings</strong></h3>
210
 
211
  <div style="width: 60%;">
@@ -216,9 +57,6 @@ If you have questions or concerns contact us anytime at <a href="mailto:info@rea
216
  <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>
217
  <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>
218
  </p>
219
- <p><input type="checkbox" name="readygraph_related_tags" value="1" style="margin: 0 10px;" <?php if(get_option('readygraph_related_tags') && get_option('readygraph_related_tags') == "true") echo "checked"; ?> >Enable Related Tags (Powered by Infolinks)</span>
220
- <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 related tags displaying below your post<br /></span></a>
221
- </p>
222
  <div class="save-changes">
223
  <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>
224
  </div>
@@ -226,376 +64,6 @@ If you have questions or concerns contact us anytime at <a href="mailto:info@rea
226
  </div>
227
 
228
  </div>
229
- </div>
230
- </form>
231
- <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
232
- <script type="text/javascript" charset="utf-8">
233
- var $ = jQuery;
234
- $(function () {
235
- var settings =
236
- {
237
- 'host': "www.readygraph.com"
238
- , 'clientId': "9838eb84c6da2fc44ab9"
239
- };
240
 
241
- var authHost = "https://" + settings.host;
242
- var resourceHost = "https://" + settings.host;
243
-
244
- // OAuth 2.0 Popup
245
- //
246
- var popupWindow=null;
247
- function openPopup(url)
248
- {
249
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
250
- 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);
251
- }
252
- function parent_disable() {
253
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
254
- }
255
-
256
- $("a.connect").click(function() {
257
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
258
- openPopup(url);
259
- $(document.body).bind('focus', parent_disable);
260
- $(document.body).bind('click', parent_disable);
261
- });
262
- $(".change-account").click(function() {
263
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
264
- var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
265
- openPopup(logout);
266
- $(document.body).bind('focus', parent_disable);
267
- $(document.body).bind('click', parent_disable);
268
- });
269
-
270
- // User Interface
271
- //
272
- $('.template').click(function() {
273
- $('#preview').attr('src', $(this).find('img').attr('src'));
274
- });
275
-
276
- // Manage OAuth 2.0 Redirect
277
- //
278
- var extractCode = function(hash) {
279
- var match = hash.match(/code=(\w+)/);
280
- return !!match && match[1];
281
- };
282
- var extractToken = function(hash) {
283
- var match = hash.match(/access_token=(\w+)/);
284
- return !!match && match[1];
285
- };
286
- var extractError = function(hash) {
287
- var match = hash.match(/error=(\w+)/);
288
- return !!match && match[1];
289
- };
290
-
291
- var code = extractCode(window.location.href);
292
- if (extractError(window.location.href) == 'access_denied') {
293
- window.close();
294
- }
295
- else if(code) {
296
- try { window.opener.setCode(code); }
297
- catch(ex) { }
298
- window.close();
299
- }
300
- else {
301
- $('.rgw-fb-login-button-iframe').hide();
302
- $('div.authenticated').show();
303
-
304
- if ($('[name="readygraph_access_token"]').val()) {
305
- $('.rgw-fb-login-button-iframe').show();
306
- $('div.authenticate').hide();
307
- $('div.authenticating').hide();
308
- $('div.authenticated').show();
309
-
310
- $('.email-address').text($('[name="readygraph_email"]').val());
311
-
312
- window.setup_readygraph($('[name="readygraph_application_id"]').val());
313
- $('.delay').val($('[name="readygraph_delay"]').val());
314
- $('.sidebar').val($('[name="readygraph_enable_sidebar"]').val());
315
- $('.notification').val($('[name="readygraph_enable_notification"]').val());
316
- $('.selectAll').val($('[name="readygraph_auto_select_all"]').val());
317
- $('.branding').val($('[name="readygraph_enable_branding"]').val());
318
- $('.blog_updates').val($('[name="readygraph_send_blog_updates"]').val());
319
- $('.real_time_post_update').val($('[name="readygraph_send_real_time_post_updates"]').val());
320
- $('.popup_template').val($('[name="readygraph_popup_template"]').val());
321
-
322
- //$('[name="readygraph_ad_format"][value="' + $('[name="_readygraph_ad_format"]').val() + '"]').parent().click();
323
- //$('[name="readygraph_ad_timing"][value="' + $('[name="_readygraph_ad_timing"]').val() + '"]').parent().click();
324
-
325
- //$('[name="readygraph_ad_delay"]').val($('[name="_readygraph_ad_delay"]').val());
326
- //$('[name="readygraph_ad_scroll"]').val($('[name="_readygraph_ad_scroll"]').val());
327
-
328
- $('.result').text('...');
329
- if ($('[name="readygraph_access_token"]').val()) {
330
- $.ajax({
331
- url: resourceHost + '/api/v1/insight_info'
332
- , beforeSend: function (xhr) {
333
- xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
334
- xhr.setRequestHeader('Accept', "application/json");
335
- }
336
- , method: 'POST'
337
- , success: function (response) {
338
- if (response.data) {
339
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
340
- } else {
341
- $('.result').text('Insight');
342
- }
343
- }
344
- , error: function (response) {
345
- refresh_access_token();
346
- }
347
- });
348
- }
349
- }
350
- }
351
-
352
- // Manage OAuth 2.0 Results
353
- //
354
- function refresh_access_token() {
355
- var refresh_token = $('[name="readygraph_refresh_token"]').val();
356
- if (refresh_token) {
357
- $('div.authenticate').hide();
358
- $('div.authenticating').show();
359
- $('div.authenticated').hide();
360
-
361
- $.ajax({
362
- url: resourceHost + '/oauth/access_token'
363
- , data: {
364
- grant_type: 'refresh_token',
365
- refresh_token: $('[name="readygraph_refresh_token"]').val(),
366
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
367
- client_id: settings.clientId
368
- }
369
- , method: 'POST'
370
- , success: function (response) {
371
- $('[name="readygraph_access_token"]').val(response.access_token);
372
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
373
- window.setAccessToken(response.access_token);
374
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
375
- }
376
- , error: function (response) {
377
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
378
- $('div.authenticate').show();
379
- $('div.authenticating').hide();
380
- $('div.authenticated').hide();
381
- }
382
- });
383
- }
384
- }
385
- window.setCode = function(code) {
386
- $('.rgw-fb-login-button-iframe').hide();
387
- $('div.authenticate').hide();
388
- $('div.authenticating').show();
389
- $('div.authenticated').hide();
390
-
391
- $.ajax({
392
- url: resourceHost + '/oauth/access_token'
393
- , data: {
394
- grant_type: 'authorization_code',
395
- code: code,
396
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
397
- client_id: settings.clientId
398
- }
399
- , method: 'POST'
400
- , success: function (response) {
401
- if (response) {
402
- $('[name="readygraph_access_token"]').val(response.access_token);
403
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
404
- window.setAccessToken(response.access_token);
405
- } else {
406
- $('div.authenticating').hide();
407
- $('div.authenticate').show();
408
- }
409
- }
410
- });
411
- }
412
- window.setAccessToken = function(token) {
413
- $('.rgw-fb-login-button-iframe').hide();
414
- $('div.authenticate').hide();
415
- $('div.authenticating').show();
416
- $('div.authenticated').hide();
417
-
418
- $.ajax({
419
- url: resourceHost + '/api/v1/account_info'
420
- , beforeSend: function (xhr) {
421
- xhr.setRequestHeader('Authorization', "Bearer " + token);
422
- xhr.setRequestHeader('Accept', "application/json");
423
- }
424
- , method: 'POST'
425
- , success: function (response) {
426
- if (response.data) {
427
- $('[name="readygraph_access_token"]').val(token);
428
- $('[name="readygraph_email"]').val(response.data.email);
429
- $('[name="readygraph_application_id"]').val(response.data.application_id);
430
- $('#myForm')[0].submit();
431
- } else {
432
- $('div.authenticating').hide();
433
- $('div.authenticate').show();
434
- $('.rgw-fb-login-button-iframe').hide();
435
- }
436
- }
437
- });
438
- }
439
- });
440
- </script>
441
- <script>
442
- window.setup = false;
443
- window.refresh_readygraph = function() {};
444
- window.setup_readygraph = function(app_id) {
445
- if (window.setup) {
446
- window.refresh_readygraph();
447
- return;
448
- }
449
- window.setup = true;
450
- readygraph.setup({
451
- applicationId: app_id,
452
- isPreview: true,
453
- enableLoginWall: false,
454
- enableDistraction: false,
455
- enableAutoLogin: false,
456
- enableSidebar: false,
457
- enableNotification: false,
458
- enableInvite: false,
459
- enableOpenGraph: false,
460
- enableRgSeo: false
461
- });
462
- readygraph.ready(function() {
463
- readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
464
- var $ = readygraph.framework.jQuery;
465
- $.cookie('RGAuth', null);
466
- readygraph.framework.facebook.logout(function() {
467
- readygraph.framework.require(['invite'], function() {
468
- var VIEW_TYPE = {
469
- LOADING: 0,
470
- LOGIN_REQUIRE: 1,
471
- PERMISSION_REQUIRE: 2,
472
- DEFAULT: 3,
473
- LOGIN_WITH_EMAIL: 4,
474
- SIGNUP_WITH_EMAIL: 5,
475
- IMPORT_WITH_EMAIL: 6,
476
- FINISH: 10
477
- };
478
-
479
- var auth = new readygraph.framework.ui.AuthModel({
480
- dialog: true,
481
- 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
482
- });
483
- $('.rg-preview-widget').html('');
484
- $('.rg-preview-widget').append(auth.lightbox.view.$el);
485
- $('.rgw-content').attr('style', 'position: relative !important;');
486
-
487
- var view = VIEW_TYPE.LOGIN_REQUIRE;
488
- auth.on('switch', function() {
489
- if (auth.view.currentView != view) { auth.view.switchView(view); }
490
- else auth.view.render();
491
- if (view == VIEW_TYPE.DEFAULT) {
492
- auth.view.$el.find('.rgw-invite-view').showAndAnimate();
493
- auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
494
- auth.view.$el.commitTransition();
495
- }
496
- });
497
- auth.view.switchView(view);
498
-
499
- $(window).scroll(function() {
500
- $(window).trigger('rgw-invalidate');
501
- });
502
- $('.rg-preview-widget, .content-warp').scroll(function() {
503
- $(window).trigger('rgw-invalidate');
504
- });
505
- $(window).trigger('rgw-invalidate');
506
-
507
- $('.rg-vertical-tab').click(function() {
508
- saveContent(auth, $('.rg-preview-widget-container'), true);
509
-
510
- $('.rg-vertical-tab').removeClass('active');
511
- $(this).addClass('active');
512
- view = VIEW_TYPE[$(this).attr('tab')];
513
- if (auth.view.currentView != view) { auth.view.switchView(view); }
514
-
515
- $('.rg-preview-widget, .content-warp').scrollTop(10000);
516
- });
517
-
518
- enableContentEditable(auth, $('.rg-preview-widget-container'));
519
- restoreContent(auth, $('.rg-preview-widget-container'));
520
-
521
- $('.save').click(function() {
522
- $('.save').css('opacity', 0.4);
523
- saveContent(auth, $('.rg-preview-widget-container'), false);
524
- });
525
-
526
- window.refresh_readygraph = function() {
527
- restoreContent(auth, $('.rg-preview-widget-container'));
528
- }
529
- });
530
- });
531
- });
532
- });
533
- }
534
- function enableContentEditable(model, container) {
535
- model.view.$el.find('[rgw-data-key]').each(function() {
536
- var element = $(this);
537
- if (element.attr('rgw-data-editable') == 'false') return;
538
-
539
- if (element.attr('editing') != null) return;
540
- container.find('.special-button-container button').attr('disabled', 'disabled');
541
- element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
542
- element.attr('editing', '1');
543
- element.css({
544
- 'border': '2px dashed orange',
545
- 'position': 'relative',
546
- 'top': '-2px',
547
- 'margin-bottom': '-4px',
548
- 'background-color': '#FAFAC5'
549
- });
550
- element.attr('contenteditable', true);
551
- element.bind('paste', function(e) {
552
- e.preventDefault();
553
- });
554
- element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
555
- });
556
- }
557
- function saveContent(model, container, fake) {
558
- var settings = {};
559
- model.view.$el.find('[rgw-data-key]').each(function() {
560
- var element = $(this);
561
- if (element.attr('rgw-data-editable') == 'false') return;
562
- settings[element.attr('rgw-data-key')] = element.text();
563
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
564
- });
565
- if (!fake) {
566
- $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
567
- $('#myForm')[0].submit();
568
- }
569
- }
570
- function restoreContent(model, container) {
571
- eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
572
- var settings = window._TEMP;
573
- if (settings) {
574
- model.view.$el.find('[rgw-data-key]').each(function() {
575
- var element = $(this);
576
- if (element.attr('rgw-data-editable') == 'false') return;
577
- element.text(settings[element.attr('rgw-data-key')]);
578
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
579
- });
580
- }
581
- }
582
- </script>
583
- <style>
584
- /* FOR INLINE WIDGET */
585
- .rgw-overlay {
586
- display: none !important;
587
- }
588
- .rgw-content-frame {
589
- left: 0 !important;
590
- top: 0 !important;
591
- position: relative !important;
592
- margin: 0 auto !important;
593
- border: solid 1px #cccccc;
594
- }
595
- .rgw-preview-warning {
596
- display: none !important;
597
- }
598
- .rgw-content {
599
- position: relative !important;
600
- }
601
- </style>
11
  * @link http://www.readygraph.com
12
  * @copyright 2014 Your Name or Company Name
13
  */
14
+ include("header.php");
15
+
16
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
18
  }
19
  else {
25
  if ($_SERVER['REQUEST_METHOD'] === 'POST') {
26
  if (isset($_POST["readygraph_monetize"]) && $_POST["readygraph_monetize"] == "1") update_option('readygraph_enable_monetize', "true");
27
  else update_option('readygraph_enable_monetize', "false");
 
 
28
  if (isset($_POST["readygraph_monetize_email"])) update_option('readygraph_monetize_email', $_POST["readygraph_monetize_email"]);
29
+ s2_readygraph_monetize_update();
30
  }
31
+ ?>
 
 
 
 
 
 
 
 
32
 
 
 
33
  <form method="post" id="myForm">
34
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
35
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
45
  <input type="hidden" name="readygraph_send_real_time_post_updates" value="<?php echo get_option('readygraph_send_real_time_post_updates', 'false') ?>">
46
  <input type="hidden" name="readygraph_popup_template" value="<?php echo get_option('readygraph_popup_template', 'default-template') ?>">
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  <div style="margin: 3% 5%">
49
+ <?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 } ?>
50
  <h3><strong>Adjust Revenue Settings</strong></h3>
51
 
52
  <div style="width: 60%;">
57
  <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>
58
  <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>
59
  </p>
 
 
 
60
  <div class="save-changes">
61
  <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>
62
  </div>
64
  </div>
65
 
66
  </div>
 
 
 
 
 
 
 
 
 
 
 
67
 
68
+ </form>
69
+ <?php include("footer.php"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
extension/readygraph/signup-popup.php CHANGED
@@ -12,35 +12,11 @@
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
- function siteprofile_sync(){
28
- $app_id = get_option('readygraph_application_id');
29
- $email = get_option('readygraph_email');
30
- $site_name = get_option('readygraph_site_name');
31
- $site_url = get_option('readygraph_site_url');
32
- $site_description = get_option('readygraph_site_description');
33
- $site_category = get_option('readygraph_site_category');
34
- $site_language = get_option('readygraph_site_language');
35
- $url = 'https://readygraph.com/api/v1/wordpress-sync-siteprofile/';
36
- $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)));
37
- }
38
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "changeaccount")s2_disconnectReadyGraph();
39
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "deleteaccount")s2_deleteReadyGraph();
40
  if(isset($_GET["readygraph_upgrade_notice"]) && $_GET["readygraph_upgrade_notice"] == "dismiss") {update_option('readygraph_upgrade_notice', 'false');}
41
- global $main_plugin_title;
42
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
43
- //redirect to main page
44
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
45
  echo '<script>window.location.replace("'.$current_url[0].'");</script>';
46
  }
@@ -58,7 +34,7 @@ function siteprofile_sync(){
58
  if (isset($_POST["site_profile_name"])) update_option('readygraph_site_name', $_POST["site_profile_name"]);
59
  if (isset($_POST["site_profile_url"])) update_option('readygraph_site_url', $_POST["site_profile_url"]);
60
  if (isset($_POST["site_category"])) update_option('readygraph_site_category', $_POST["site_category"]);
61
- if (isset($_POST["site_language"])) {update_option('readygraph_site_language', $_POST["site_language"]);siteprofile_sync();}
62
 
63
  if (isset($_POST["readygraph_settings"])) update_option('readygraph_settings', $_POST["readygraph_settings"]);
64
  if (isset($_POST["readygraph_delay"])) {
@@ -85,8 +61,6 @@ function siteprofile_sync(){
85
  </style>
86
  <?php } ?>
87
 
88
- <link rel="stylesheet" type="text/css" href="<?php echo plugins_url( 'assets/css/admin.css', __FILE__ ) ?>">
89
- <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/admin.js', __FILE__ ) ?>"></script>
90
  <form method="post" id="myForm">
91
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
92
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
@@ -100,531 +74,99 @@ function siteprofile_sync(){
100
  <input type="hidden" name="readygraph_send_blog_updates" value="<?php echo get_option('readygraph_send_blog_updates', 'true') ?>">
101
  <input type="hidden" name="readygraph_send_real_time_post_updates" value="<?php echo get_option('readygraph_send_real_time_post_updates', 'false') ?>">
102
  <input type="hidden" name="readygraph_popup_template" value="<?php echo get_option('readygraph_popup_template', 'default-template') ?>">
103
-
104
-
105
- <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>
106
- <div class="authenticated" style="display: none;">
107
- <div style="background-color: #2961cb; min-width: 90%; height: 50px;margin-right: 1%;">
108
- <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/white-logo.png" style="width: 138px; height: 30px; margin: 10px 0 0 15px; float: left;">
109
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
110
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
111
- <span class="email-address" style="text-shadow: none;"></span> <span class="caret"></span>
112
- </button>
113
- <ul class="dropdown-menu">
114
- <li><a class="change-account" href="#">Change Account</a></li>
115
- <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>
116
- <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>
117
- </ul>
118
- </div>
119
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
120
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
121
- <span class="result" style="text-shadow: none;">...</span> <span class="caret"></span>
122
- </button>
123
- <ul class="dropdown-menu">
124
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Insights</a></li>
125
- </ul>
126
- </div>
127
- <div style="clear: both;"></div>
128
- </div>
129
- <!-- write menu code-->
130
-
131
- <div class="readygraph-nav-menu">
132
- <ul><li>Grow Users
133
- <ul>
134
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
135
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
136
- <li><a href="#"></a></li>
137
- </ul>
138
- </li>
139
- <li>Email Users
140
- <ul>
141
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
142
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
143
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
144
- </ul>
145
- </li>
146
- <li>
147
- Engage Users
148
- <ul>
149
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed">Social Feed</a></li>
150
- <li><a href="#">Social Followers</a></li>
151
- <li><a href="#">Feedback Survey</a></li>
152
- </ul>
153
- </li>
154
- <li>Basic Settings
155
- <ul>
156
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
157
- <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>
158
- </ul>
159
- </li>
160
- </ul>
161
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
162
- <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
163
- </div>
164
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
165
- <p>
166
- <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>
167
- </div>
168
- <div class="btn-group" style="">
169
- <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>
170
- </div>
171
- </div>
172
  <div><div><a href="#">Grow Users</a> > Signup Popup</div>
173
  <?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>
174
  <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>
175
  </div>
176
  <?php } ?>
177
- <h3 style="font-weight: normal; text-align: center;">Increase signups with the Intelligent Signup Popup</h3>
178
- <h4 style="font-weight: normal; text-align: center;">Users instantly added to your list - One Click Signup - Automatically targets engaged users</h4>
179
- <div style="width: 90%; margin: 0 auto;">
180
- <div class="rg-vertical-tab-body-container" style="width: 50%; text-align: center;float: left">
181
- <div class="btn-group" data-toggle="buttons" style="padding: 20px 0;">
182
- <label class="btn btn-primary active rg-vertical-tab" tab="LOGIN_REQUIRE">
183
- <input type="radio" name="options" id="option1"> Facebook Connect
184
- </label>
185
- <label class="btn btn-primary rg-vertical-tab" tab="LOGIN_WITH_EMAIL">
186
- <input type="radio" name="options" id="option2"> Email Sign In
187
- </label>
188
- <label class="btn btn-primary rg-vertical-tab" tab="IMPORT_WITH_EMAIL">
189
- <input type="radio" name="options" id="option3"> Contact Importer
190
- </label>
191
- <label class="btn btn-primary rg-vertical-tab" tab="DEFAULT">
192
- <input type="radio" name="options" id="option4"> Invitation Page
193
- </label>
194
- <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>
195
- </div>
196
- <div class="rg-preview-widget" style=""></div>
197
- </div>
198
- <div style="width:50%; border-left: solid 1px #cccccc; text-align: left;padding-left: 25px;float:right">
199
- <div style="padding: 20px 0;">
200
- <p>Popup Templates:
201
- <select class="popup_template" name="popup_template" class="form-control">
202
- <option value="default-template">Default Template</option>
203
- <option value="red-template">Red Template</option>
204
- <option value="blue-template">Blue Template</option>
205
- <option value="black-template">Black Template</option>
206
- <option value="gray-template">Gray Template</option>
207
- <option value="green-template">Green Template</option>
208
- <option value="yellow-template">Yellow Template</option>
209
- <option value="custom-template">Custom Template</option>
210
- </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 />
211
- <p>Signup Popup Delay:
212
- <select class="delay" name="delay" class="form-control">
213
- <option value="0">0 seconds</option>
214
- <option value="5000">5 seconds</option>
215
- <option value="10000">10 seconds</option>
216
- <option value="15000">15 seconds</option>
217
- <option value="20000">20 seconds</option>
218
- <option value="30000">30 seconds</option>
219
- <option value="60000">1 minute</option>
220
- <option value="120000">2 minutes</option>
221
- <option value="180000">3 minutes</option>
222
- <option value="240000">4 minutes</option>
223
- <option value="300000">5 minutes</option>
224
- <option value="600000">10 minutes</option>
225
- <option value="900000">15 minutes</option>
226
- <option value="1200000">20 minutes</option>
227
- </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 />
228
 
229
- <p>Enable Lower Right Notification:
230
- <select class="notification" name="notification" class="form-control">
231
- <option value="true">YES</option>
232
- <option value="false">NO</option>
233
- </select></p><br />
234
- <p>Pre-checked Invite Contact:
235
- <select class="selectAll" name="selectAll" class="form-control">
236
- <option value="true">YES</option>
237
- <option value="false">NO</option>
238
- </select></p><br />
239
- <p>Show Powered by Readygraph on popup:
240
- <select class="branding" name="branding" class="form-control">
241
- <option value="true">YES</option>
242
- <option value="false">NO</option>
243
- </select></p><br />
244
- <p>Include blog updates in daily/weekly email digest of Readygraph:
245
- <select class="blog_updates" name="blog_updates" class="form-control">
246
- <option value="true">YES</option>
247
- <option value="false">NO</option>
248
- </select></p><br />
249
- <p>Send Real Time Post Updates to your subscribers:
250
- <select class="real_time_post_update" name="real_time_post_update" class="form-control">
251
- <option value="true">YES</option>
252
- <option value="false">NO</option>
253
- </select></p><br />
254
 
255
 
256
- <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 />
257
- </div>
258
- <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 } ?>
259
- <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>
260
- <?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 } ?>
261
- </div>
262
- </div>
263
- </div>
264
  </div>
265
- </div>
266
- </form>
267
- <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
268
- <script type="text/javascript" charset="utf-8">
269
- var $ = jQuery;
270
- $(function () {
271
- var settings =
272
- {
273
- 'host': "www.readygraph.com"
274
- , 'clientId': "9838eb84c6da2fc44ab9"
275
- };
276
-
277
- var authHost = "https://" + settings.host;
278
- var resourceHost = "https://" + settings.host;
279
-
280
- // OAuth 2.0 Popup
281
- //
282
- var popupWindow=null;
283
- function openPopup(url)
284
- {
285
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
286
- 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);
287
- }
288
- function parent_disable() {
289
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
290
- }
291
-
292
- $("a.connect").click(function() {
293
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
294
- openPopup(url);
295
- $(document.body).bind('focus', parent_disable);
296
- $(document.body).bind('click', parent_disable);
297
- });
298
- $(".change-account").click(function() {
299
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
300
- var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
301
- openPopup(logout);
302
- $(document.body).bind('focus', parent_disable);
303
- $(document.body).bind('click', parent_disable);
304
- });
305
-
306
- // User Interface
307
- //
308
- $('.template').click(function() {
309
- $('#preview').attr('src', $(this).find('img').attr('src'));
310
- });
311
-
312
- // Manage OAuth 2.0 Redirect
313
- //
314
- var extractCode = function(hash) {
315
- var match = hash.match(/code=(\w+)/);
316
- return !!match && match[1];
317
- };
318
- var extractToken = function(hash) {
319
- var match = hash.match(/access_token=(\w+)/);
320
- return !!match && match[1];
321
- };
322
- var extractError = function(hash) {
323
- var match = hash.match(/error=(\w+)/);
324
- return !!match && match[1];
325
- };
326
-
327
- var code = extractCode(window.location.href);
328
- if (extractError(window.location.href) == 'access_denied') {
329
- window.close();
330
- }
331
- else if(code) {
332
- try { window.opener.setCode(code); }
333
- catch(ex) { }
334
- window.close();
335
- }
336
- else {
337
- $('.rgw-fb-login-button-iframe').hide();
338
- $('div.authenticate').show();
339
-
340
- if ($('[name="readygraph_access_token"]').val()) {
341
- $('.rgw-fb-login-button-iframe').show();
342
- $('div.authenticate').hide();
343
- $('div.authenticating').hide();
344
- $('div.authenticated').show();
345
-
346
- $('.email-address').text($('[name="readygraph_email"]').val());
347
-
348
- window.setup_readygraph($('[name="readygraph_application_id"]').val());
349
- $('.delay').val($('[name="readygraph_delay"]').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
- $('.result').text('...');
358
- if ($('[name="readygraph_access_token"]').val()) {
359
- $.ajax({
360
- url: resourceHost + '/api/v1/insight_info'
361
- , beforeSend: function (xhr) {
362
- xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
363
- xhr.setRequestHeader('Accept', "application/json");
364
- }
365
- , method: 'POST'
366
- , success: function (response) {
367
- if (response.data) {
368
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
369
- } else {
370
- $('.result').text('Insight');
371
- }
372
- }
373
- , error: function (response) {
374
- refresh_access_token();
375
- }
376
- });
377
- }
378
- }
379
- }
380
-
381
- // Manage OAuth 2.0 Results
382
 
383
- function refresh_access_token() {
384
- var refresh_token = $('[name="readygraph_refresh_token"]').val();
385
- if (refresh_token) {
386
- $('div.authenticate').hide();
387
- $('div.authenticating').show();
388
- $('div.authenticated').hide();
389
-
390
- $.ajax({
391
- url: resourceHost + '/oauth/access_token'
392
- , data: {
393
- grant_type: 'refresh_token',
394
- refresh_token: $('[name="readygraph_refresh_token"]').val(),
395
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
396
- client_id: settings.clientId
397
- }
398
- , method: 'POST'
399
- , success: function (response) {
400
- $('[name="readygraph_access_token"]').val(response.access_token);
401
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
402
- window.setAccessToken(response.access_token);
403
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
404
- }
405
- , error: function (response) {
406
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
407
- $('div.authenticate').show();
408
- $('div.authenticating').hide();
409
- $('div.authenticated').hide();
410
- }
411
- });
412
- }
413
- }
414
- window.setCode = function(code) {
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 + '/oauth/access_token'
422
- , data: {
423
- grant_type: 'authorization_code',
424
- code: code,
425
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
426
- client_id: settings.clientId
427
- }
428
- , method: 'POST'
429
- , success: function (response) {
430
- if (response) {
431
- $('[name="readygraph_access_token"]').val(response.access_token);
432
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
433
- window.setAccessToken(response.access_token);
434
- } else {
435
- $('div.authenticating').hide();
436
- $('div.authenticate').show();
437
- }
438
- }
439
- });
440
- }
441
- window.setAccessToken = function(token) {
442
- $('.rgw-fb-login-button-iframe').hide();
443
- $('div.authenticate').hide();
444
- $('div.authenticating').show();
445
- $('div.authenticated').hide();
446
-
447
- $.ajax({
448
- url: resourceHost + '/api/v1/account_info'
449
- , beforeSend: function (xhr) {
450
- xhr.setRequestHeader('Authorization', "Bearer " + token);
451
- xhr.setRequestHeader('Accept', "application/json");
452
- }
453
- , method: 'POST'
454
- , success: function (response) {
455
- if (response.data) {
456
- $('[name="readygraph_access_token"]').val(token);
457
- $('[name="readygraph_email"]').val(response.data.email);
458
- $('[name="readygraph_application_id"]').val(response.data.application_id);
459
- $('#myForm')[0].submit();
460
- } else {
461
- $('div.authenticating').hide();
462
- $('div.authenticate').show();
463
- $('.rgw-fb-login-button-iframe').hide();
464
- }
465
- }
466
- });
467
- }
468
- });
469
- </script>
470
- <script>
471
- window.setup = false;
472
- window.refresh_readygraph = function() {};
473
- window.setup_readygraph = function(app_id) {
474
- if (window.setup) {
475
- window.refresh_readygraph();
476
- return;
477
- }
478
- window.setup = true;
479
- readygraph.setup({
480
- applicationId: app_id,
481
- isPreview: true,
482
- enableLoginWall: false,
483
- enableDistraction: false,
484
- enableAutoLogin: false,
485
- enableSidebar: false,
486
- enableNotification: false,
487
- enableInvite: false,
488
- enableOpenGraph: false,
489
- enableRgSeo: false
490
- });
491
- readygraph.ready(function() {
492
- readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
493
- var $ = readygraph.framework.jQuery;
494
- $.cookie('RGAuth', null);
495
- readygraph.framework.facebook.logout(function() {
496
- readygraph.framework.require(['invite'], function() {
497
- var VIEW_TYPE = {
498
- LOADING: 0,
499
- LOGIN_REQUIRE: 1,
500
- PERMISSION_REQUIRE: 2,
501
- DEFAULT: 3,
502
- LOGIN_WITH_EMAIL: 4,
503
- SIGNUP_WITH_EMAIL: 5,
504
- IMPORT_WITH_EMAIL: 6,
505
- FINISH: 10
506
- };
507
-
508
- var auth = new readygraph.framework.ui.AuthModel({
509
- dialog: true,
510
- 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
511
- });
512
- $('.rg-preview-widget').html('');
513
- $('.rg-preview-widget').append(auth.lightbox.view.$el);
514
- $('.rgw-content').attr('style', 'position: relative !important;');
515
-
516
- var view = VIEW_TYPE.LOGIN_REQUIRE;
517
- auth.on('switch', function() {
518
- if (auth.view.currentView != view) { auth.view.switchView(view); }
519
- else auth.view.render();
520
- if (view == VIEW_TYPE.DEFAULT) {
521
- auth.view.$el.find('.rgw-invite-view').showAndAnimate();
522
- auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
523
- auth.view.$el.commitTransition();
524
- }
525
- });
526
- auth.view.switchView(view);
527
-
528
- $(window).scroll(function() {
529
- $(window).trigger('rgw-invalidate');
530
- });
531
- $('.rg-preview-widget, .content-warp').scroll(function() {
532
- $(window).trigger('rgw-invalidate');
533
- });
534
- $(window).trigger('rgw-invalidate');
535
-
536
- $('.rg-vertical-tab').click(function() {
537
- saveContent(auth, $('.rg-preview-widget-container'), true);
538
-
539
- $('.rg-vertical-tab').removeClass('active');
540
- $(this).addClass('active');
541
- view = VIEW_TYPE[$(this).attr('tab')];
542
- if (auth.view.currentView != view) { auth.view.switchView(view); }
543
-
544
- $('.rg-preview-widget, .content-warp').scrollTop(10000);
545
- });
546
-
547
- enableContentEditable(auth, $('.rg-preview-widget-container'));
548
- restoreContent(auth, $('.rg-preview-widget-container'));
549
-
550
- $('.save').click(function() {
551
- $('.save').css('opacity', 0.4);
552
- saveContent(auth, $('.rg-preview-widget-container'), false);
553
- });
554
-
555
- window.refresh_readygraph = function() {
556
- restoreContent(auth, $('.rg-preview-widget-container'));
557
- }
558
- });
559
- });
560
- });
561
- });
562
- }
563
- function enableContentEditable(model, container) {
564
- model.view.$el.find('[rgw-data-key]').each(function() {
565
- var element = $(this);
566
- if (element.attr('rgw-data-editable') == 'false') return;
567
-
568
- if (element.attr('editing') != null) return;
569
- container.find('.special-button-container button').attr('disabled', 'disabled');
570
- element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
571
- element.attr('editing', '1');
572
- element.css({
573
- 'border': '2px dashed orange',
574
- 'position': 'relative',
575
- 'top': '-2px',
576
- 'margin-bottom': '-4px',
577
- 'background-color': '#FAFAC5'
578
- });
579
- element.attr('contenteditable', true);
580
- element.bind('paste', function(e) {
581
- e.preventDefault();
582
- });
583
- element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
584
- });
585
- }
586
- function saveContent(model, container, fake) {
587
- var settings = {};
588
- model.view.$el.find('[rgw-data-key]').each(function() {
589
- var element = $(this);
590
- if (element.attr('rgw-data-editable') == 'false') return;
591
- settings[element.attr('rgw-data-key')] = element.text();
592
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
593
- });
594
- if (!fake) {
595
- $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
596
- $('#myForm')[0].submit();
597
- }
598
- }
599
- function restoreContent(model, container) {
600
- eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
601
- var settings = window._TEMP;
602
- if (settings) {
603
- model.view.$el.find('[rgw-data-key]').each(function() {
604
- var element = $(this);
605
- if (element.attr('rgw-data-editable') == 'false') return;
606
- element.text(settings[element.attr('rgw-data-key')]);
607
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
608
- });
609
- }
610
- }
611
- </script>
612
- <style>
613
- /* FOR INLINE WIDGET */
614
- .rgw-overlay {
615
- display: none !important;
616
- }
617
- .rgw-content-frame {
618
- left: 0 !important;
619
- top: 0 !important;
620
- position: relative !important;
621
- margin: 0 auto !important;
622
- border: solid 1px #cccccc;
623
- }
624
- .rgw-preview-warning {
625
- display: none !important;
626
- }
627
- .rgw-content {
628
- position: relative !important;
629
- }
630
- </style>
12
  * @copyright 2014 Your Name or Company Name
13
  */
14
 
15
+
16
+ include("header.php");
17
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  if(isset($_GET["readygraph_upgrade_notice"]) && $_GET["readygraph_upgrade_notice"] == "dismiss") {update_option('readygraph_upgrade_notice', 'false');}
 
19
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
 
20
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
21
  echo '<script>window.location.replace("'.$current_url[0].'");</script>';
22
  }
34
  if (isset($_POST["site_profile_name"])) update_option('readygraph_site_name', $_POST["site_profile_name"]);
35
  if (isset($_POST["site_profile_url"])) update_option('readygraph_site_url', $_POST["site_profile_url"]);
36
  if (isset($_POST["site_category"])) update_option('readygraph_site_category', $_POST["site_category"]);
37
+ if (isset($_POST["site_language"])) {update_option('readygraph_site_language', $_POST["site_language"]);s2_siteprofile_sync();}
38
 
39
  if (isset($_POST["readygraph_settings"])) update_option('readygraph_settings', $_POST["readygraph_settings"]);
40
  if (isset($_POST["readygraph_delay"])) {
61
  </style>
62
  <?php } ?>
63
 
 
 
64
  <form method="post" id="myForm">
65
  <input type="hidden" name="readygraph_access_token" value="<?php echo get_option('readygraph_access_token', '') ?>">
66
  <input type="hidden" name="readygraph_refresh_token" value="<?php echo get_option('readygraph_refresh_token', '') ?>">
74
  <input type="hidden" name="readygraph_send_blog_updates" value="<?php echo get_option('readygraph_send_blog_updates', 'true') ?>">
75
  <input type="hidden" name="readygraph_send_real_time_post_updates" value="<?php echo get_option('readygraph_send_real_time_post_updates', 'false') ?>">
76
  <input type="hidden" name="readygraph_popup_template" value="<?php echo get_option('readygraph_popup_template', 'default-template') ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  <div><div><a href="#">Grow Users</a> > Signup Popup</div>
78
  <?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>
79
  <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>
80
  </div>
81
  <?php } ?>
82
+ <h3 style="font-weight: normal; text-align: center;">Increase signups with the Intelligent Signup Popup</h3>
83
+ <h4 style="font-weight: normal; text-align: center;">Users instantly added to your list - One Click Signup - Automatically targets engaged users</h4>
84
+ <div style="width: 90%; margin: 0 auto;">
85
+ <div class="rg-vertical-tab-body-container" style="width: 50%; text-align: center;float: left">
86
+ <div class="btn-group" data-toggle="buttons" style="padding: 20px 0;">
87
+ <label class="btn btn-primary active rg-vertical-tab" tab="LOGIN_REQUIRE">
88
+ <input type="radio" name="options" id="option1"> Facebook Connect
89
+ </label>
90
+ <label class="btn btn-primary rg-vertical-tab" tab="LOGIN_WITH_EMAIL">
91
+ <input type="radio" name="options" id="option2"> Email Sign In
92
+ </label>
93
+ <label class="btn btn-primary rg-vertical-tab" tab="IMPORT_WITH_EMAIL">
94
+ <input type="radio" name="options" id="option3"> Contact Importer
95
+ </label>
96
+ <label class="btn btn-primary rg-vertical-tab" tab="DEFAULT">
97
+ <input type="radio" name="options" id="option4"> Invitation Page
98
+ </label>
99
+ <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>
100
+ </div>
101
+ <div class="rg-preview-widget" style=""></div>
102
+ </div>
103
+ <div style="width:50%; border-left: solid 1px #cccccc; text-align: left;padding-left: 25px;float:right">
104
+ <div style="padding: 20px 0;">
105
+ <p>Popup Templates:
106
+ <select class="popup_template" name="popup_template" class="form-control">
107
+ <option value="default-template">Default Template</option>
108
+ <option value="red-template">Red Template</option>
109
+ <option value="blue-template">Blue Template</option>
110
+ <option value="black-template">Black Template</option>
111
+ <option value="gray-template">Gray Template</option>
112
+ <option value="green-template">Green Template</option>
113
+ <option value="yellow-template">Yellow Template</option>
114
+ <option value="custom-template">Custom Template</option>
115
+ </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 />
116
+ <p>Signup Popup Delay:
117
+ <select class="delay" name="delay" class="form-control">
118
+ <option value="0">0 seconds</option>
119
+ <option value="5000">5 seconds</option>
120
+ <option value="10000">10 seconds</option>
121
+ <option value="15000">15 seconds</option>
122
+ <option value="20000">20 seconds</option>
123
+ <option value="30000">30 seconds</option>
124
+ <option value="60000">1 minute</option>
125
+ <option value="120000">2 minutes</option>
126
+ <option value="180000">3 minutes</option>
127
+ <option value="240000">4 minutes</option>
128
+ <option value="300000">5 minutes</option>
129
+ <option value="600000">10 minutes</option>
130
+ <option value="900000">15 minutes</option>
131
+ <option value="1200000">20 minutes</option>
132
+ </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 />
133
 
134
+ <p>Enable Lower Right Notification:
135
+ <select class="notification" name="notification" class="form-control">
136
+ <option value="true">YES</option>
137
+ <option value="false">NO</option>
138
+ </select></p><br />
139
+ <p>Pre-checked Invite Contact:
140
+ <select class="selectAll" name="selectAll" class="form-control">
141
+ <option value="true">YES</option>
142
+ <option value="false">NO</option>
143
+ </select></p><br />
144
+ <p>Show Powered by Readygraph on popup:
145
+ <select class="branding" name="branding" class="form-control">
146
+ <option value="true">YES</option>
147
+ <option value="false">NO</option>
148
+ </select></p><br />
149
+ <p>Include blog updates in daily/weekly email digest of Readygraph:
150
+ <select class="blog_updates" name="blog_updates" class="form-control">
151
+ <option value="true">YES</option>
152
+ <option value="false">NO</option>
153
+ </select></p><br />
154
+ <p>Send Real Time Post Updates to your subscribers:
155
+ <select class="real_time_post_update" name="real_time_post_update" class="form-control">
156
+ <option value="true">YES</option>
157
+ <option value="false">NO</option>
158
+ </select></p><br />
159
 
160
 
161
+ <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 />
162
+ </div>
163
+ <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 } ?>
164
+ <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>
165
+ <?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 } ?>
166
+ </div>
167
+ </div>
168
+ </div>
169
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
 
171
+ </form>
172
+ <?php include("footer.php"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
extension/readygraph/site-profile.php CHANGED
@@ -12,33 +12,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
- function siteprofile_sync(){
28
- $app_id = get_option('readygraph_application_id');
29
- $email = get_option('readygraph_email');
30
- $site_name = get_option('readygraph_site_name');
31
- $site_url = get_option('readygraph_site_url');
32
- $site_description = get_option('readygraph_site_description');
33
- $site_category = get_option('readygraph_site_category');
34
- $site_language = get_option('readygraph_site_language');
35
- $url = 'https://readygraph.com/api/v1/wordpress-sync-siteprofile/';
36
- $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)));
37
- }
38
 
39
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "changeaccount")s2_disconnectReadyGraph();
40
- if(isset($_GET["action"]) && base64_decode($_GET["action"]) == "deleteaccount")s2_deleteReadyGraph();
41
- global $main_plugin_title;
42
  if (!get_option('readygraph_access_token') || strlen(get_option('readygraph_access_token')) <= 0) {
43
  //redirect to main page
44
  $current_url = explode("&", $_SERVER['REQUEST_URI']);
@@ -55,15 +30,14 @@ function siteprofile_sync(){
55
  if (isset($_POST["site_category"])) update_option('readygraph_site_category', $_POST["site_category"]);
56
  if (isset($_POST["site_language"])) update_option('readygraph_site_language', $_POST["site_language"]);
57
  if ($_SERVER['REQUEST_METHOD'] === 'POST') {
58
- siteprofile_sync();
59
  }
60
  }
61
  if(isset($_GET["readygraph_plan"]) && $_GET["readygraph_plan"] != ""){update_option('readygraph_plan',$_GET["readygraph_plan"]);}
62
 
63
  ?>
64
 
65
- <link rel="stylesheet" type="text/css" href="<?php echo plugins_url( 'assets/css/admin.css', __FILE__ ) ?>">
66
- <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/admin.js', __FILE__ ) ?>"></script>
67
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
68
  <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/jquery.dependent-selects.js', __FILE__ ) ?>"></script>
69
  <script type="text/javascript" charset="utf-8">
@@ -81,75 +55,7 @@ $(function(){
81
  <input type="hidden" name="readygraph_application_id" value="<?php echo get_option('readygraph_application_id', '') ?>">
82
  <input type="hidden" name="readygraph_site_category" value="<?php echo get_option('readygraph_site_category', '') ?>">
83
  <input type="hidden" name="readygraph_site_language" value="<?php echo get_option('readygraph_site_language', '') ?>">
84
-
85
- <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>
86
- <div class="authenticated" style="display: none;">
87
- <div style="background-color: #2961cb; min-width: 90%; height: 50px;margin-right: 1%;">
88
- <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/white-logo.png" style="width: 138px; height: 30px; margin: 10px 0 0 15px; float: left;">
89
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
90
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
91
- <span class="email-address" style="text-shadow: none;"></span> <span class="caret"></span>
92
- </button>
93
- <ul class="dropdown-menu">
94
- <li><a class="change-account" href="#">Change Account</a></li>
95
- <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>
96
- <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>
97
- </ul>
98
- </div>
99
- <div class="btn-group pull-right" style="margin: 8px 10px 0 0;">
100
- <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="background: transparent; border-color: #ffffff; color: #ffffff; ">
101
- <span class="result" style="text-shadow: none;">...</span> <span class="caret"></span>
102
- </button>
103
- <ul class="dropdown-menu">
104
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Insights</a></li>
105
- </ul>
106
- </div>
107
- <div style="clear: both;"></div>
108
- </div>
109
- <!-- write menu code-->
110
-
111
- <div class="readygraph-nav-menu">
112
- <ul><li>Grow Users
113
- <ul>
114
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
115
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
116
- <li><a href="#"></a></li>
117
- </ul>
118
- </li>
119
- <li>Email Users
120
- <ul>
121
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
122
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
123
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
124
- </ul>
125
- </li>
126
- <li>
127
- Engage Users
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
- </li>
134
- <li>Basic Settings
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><li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=monetization-settings">Monetization Settings</a></li>
138
- </ul>
139
- </li>
140
- </ul>
141
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
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
- </div>
144
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
145
- <p>
146
- <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>
147
- </div>
148
- <div class="btn-group" style="">
149
- <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>
150
- </div>
151
- </div>
152
- <div><div><a href="#">Basic Settings</a> > Site Profile</div>
153
  <?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>
154
  <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>
155
  </div>
@@ -435,7 +341,6 @@ wp_editor( $content, $editor_id, $settings );
435
  </div>
436
  </div>
437
  </form>
438
- <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
439
 
440
  <script type="text/javascript" charset="utf-8">
441
  var $ = jQuery;
@@ -448,360 +353,4 @@ if (language != ""){
448
  $('#site_language').val(language);
449
  }
450
  </script>
451
- <script type="text/javascript" charset="utf-8">
452
- var $ = jQuery;
453
- $(function () {
454
- var settings =
455
- {
456
- 'host': "www.readygraph.com"
457
- , 'clientId': "9838eb84c6da2fc44ab9"
458
- };
459
-
460
- var authHost = "https://" + settings.host;
461
- var resourceHost = "https://" + settings.host;
462
-
463
- // OAuth 2.0 Popup
464
- //
465
- var popupWindow=null;
466
- function openPopup(url)
467
- {
468
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
469
- 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);
470
- }
471
- function parent_disable() {
472
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
473
- }
474
-
475
- $("a.connect").click(function() {
476
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
477
- openPopup(url);
478
- $(document.body).bind('focus', parent_disable);
479
- $(document.body).bind('click', parent_disable);
480
- });
481
- $(".change-account").click(function() {
482
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
483
- var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
484
- openPopup(logout);
485
- $(document.body).bind('focus', parent_disable);
486
- $(document.body).bind('click', parent_disable);
487
- });
488
-
489
- // User Interface
490
- //
491
- $('.template').click(function() {
492
- $('#preview').attr('src', $(this).find('img').attr('src'));
493
- });
494
-
495
- // Manage OAuth 2.0 Redirect
496
- //
497
- var extractCode = function(hash) {
498
- var match = hash.match(/code=(\w+)/);
499
- return !!match && match[1];
500
- };
501
- var extractToken = function(hash) {
502
- var match = hash.match(/access_token=(\w+)/);
503
- return !!match && match[1];
504
- };
505
- var extractError = function(hash) {
506
- var match = hash.match(/error=(\w+)/);
507
- return !!match && match[1];
508
- };
509
-
510
- var code = extractCode(window.location.href);
511
- if (extractError(window.location.href) == 'access_denied') {
512
- window.close();
513
- }
514
- else if(code) {
515
- try { window.opener.setCode(code); }
516
- catch(ex) { }
517
- window.close();
518
- }
519
- else {
520
- $('.rgw-fb-login-button-iframe').hide();
521
- $('div.authenticate').show();
522
-
523
- if ($('[name="readygraph_access_token"]').val()) {
524
- $('.rgw-fb-login-button-iframe').show();
525
- $('div.authenticate').hide();
526
- $('div.authenticating').hide();
527
- $('div.authenticated').show();
528
-
529
- $('.email-address').text($('[name="readygraph_email"]').val());
530
-
531
- window.setup_readygraph($('[name="readygraph_application_id"]').val());
532
-
533
-
534
- $('.result').text('...');
535
- if ($('[name="readygraph_access_token"]').val()) {
536
- $.ajax({
537
- url: resourceHost + '/api/v1/insight_info'
538
- , beforeSend: function (xhr) {
539
- xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
540
- xhr.setRequestHeader('Accept', "application/json");
541
- }
542
- , method: 'POST'
543
- , success: function (response) {
544
- if (response.data) {
545
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
546
- } else {
547
- $('.result').text('Insight');
548
- }
549
- }
550
- , error: function (response) {
551
- refresh_access_token();
552
- }
553
- });
554
- }
555
- }
556
- }
557
-
558
- // Manage OAuth 2.0 Results
559
- //
560
- function refresh_access_token() {
561
- var refresh_token = $('[name="readygraph_refresh_token"]').val();
562
- if (refresh_token) {
563
- $('div.authenticate').hide();
564
- $('div.authenticating').show();
565
- $('div.authenticated').hide();
566
-
567
- $.ajax({
568
- url: resourceHost + '/oauth/access_token'
569
- , data: {
570
- grant_type: 'refresh_token',
571
- refresh_token: $('[name="readygraph_refresh_token"]').val(),
572
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
573
- client_id: settings.clientId
574
- }
575
- , method: 'POST'
576
- , success: function (response) {
577
- $('[name="readygraph_access_token"]').val(response.access_token);
578
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
579
- window.setAccessToken(response.access_token);
580
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
581
- }
582
- , error: function (response) {
583
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
584
- $('div.authenticate').show();
585
- $('div.authenticating').hide();
586
- $('div.authenticated').hide();
587
- }
588
- });
589
- }
590
- }
591
- window.setCode = function(code) {
592
- $('.rgw-fb-login-button-iframe').hide();
593
- $('div.authenticate').hide();
594
- $('div.authenticating').show();
595
- $('div.authenticated').hide();
596
-
597
- $.ajax({
598
- url: resourceHost + '/oauth/access_token'
599
- , data: {
600
- grant_type: 'authorization_code',
601
- code: code,
602
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
603
- client_id: settings.clientId
604
- }
605
- , method: 'POST'
606
- , success: function (response) {
607
- if (response) {
608
- $('[name="readygraph_access_token"]').val(response.access_token);
609
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
610
- window.setAccessToken(response.access_token);
611
- } else {
612
- $('div.authenticating').hide();
613
- $('div.authenticate').show();
614
- }
615
- }
616
- });
617
- }
618
- window.setAccessToken = function(token) {
619
- $('.rgw-fb-login-button-iframe').hide();
620
- $('div.authenticate').hide();
621
- $('div.authenticating').show();
622
- $('div.authenticated').hide();
623
-
624
- $.ajax({
625
- url: resourceHost + '/api/v1/account_info'
626
- , beforeSend: function (xhr) {
627
- xhr.setRequestHeader('Authorization', "Bearer " + token);
628
- xhr.setRequestHeader('Accept', "application/json");
629
- }
630
- , method: 'POST'
631
- , success: function (response) {
632
- if (response.data) {
633
- $('[name="readygraph_access_token"]').val(token);
634
- $('[name="readygraph_email"]').val(response.data.email);
635
- $('[name="readygraph_application_id"]').val(response.data.application_id);
636
- $('#myForm')[0].submit();
637
- } else {
638
- $('div.authenticating').hide();
639
- $('div.authenticate').show();
640
- $('.rgw-fb-login-button-iframe').hide();
641
- }
642
- }
643
- });
644
- }
645
- });
646
- </script>
647
- <script>
648
- window.setup = false;
649
- window.refresh_readygraph = function() {};
650
- window.setup_readygraph = function(app_id) {
651
- if (window.setup) {
652
- window.refresh_readygraph();
653
- return;
654
- }
655
- window.setup = true;
656
- readygraph.setup({
657
- applicationId: app_id,
658
- isPreview: true,
659
- enableLoginWall: false,
660
- enableDistraction: false,
661
- enableAutoLogin: false,
662
- enableSidebar: false,
663
- enableNotification: false,
664
- enableInvite: false,
665
- enableOpenGraph: false,
666
- enableRgSeo: false
667
- });
668
- readygraph.ready(function() {
669
- readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
670
- var $ = readygraph.framework.jQuery;
671
- $.cookie('RGAuth', null);
672
- readygraph.framework.facebook.logout(function() {
673
- readygraph.framework.require(['invite'], function() {
674
- var VIEW_TYPE = {
675
- LOADING: 0,
676
- LOGIN_REQUIRE: 1,
677
- PERMISSION_REQUIRE: 2,
678
- DEFAULT: 3,
679
- LOGIN_WITH_EMAIL: 4,
680
- SIGNUP_WITH_EMAIL: 5,
681
- IMPORT_WITH_EMAIL: 6,
682
- FINISH: 10
683
- };
684
-
685
- var auth = new readygraph.framework.ui.AuthModel({
686
- dialog: true,
687
- 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
688
- });
689
- $('.rg-preview-widget').html('');
690
- $('.rg-preview-widget').append(auth.lightbox.view.$el);
691
- $('.rgw-content').attr('style', 'position: relative !important;');
692
-
693
- var view = VIEW_TYPE.LOGIN_REQUIRE;
694
- auth.on('switch', function() {
695
- if (auth.view.currentView != view) { auth.view.switchView(view); }
696
- else auth.view.render();
697
- if (view == VIEW_TYPE.DEFAULT) {
698
- auth.view.$el.find('.rgw-invite-view').showAndAnimate();
699
- auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
700
- auth.view.$el.commitTransition();
701
- }
702
- });
703
- auth.view.switchView(view);
704
-
705
- $(window).scroll(function() {
706
- $(window).trigger('rgw-invalidate');
707
- });
708
- $('.rg-preview-widget, .content-warp').scroll(function() {
709
- $(window).trigger('rgw-invalidate');
710
- });
711
- $(window).trigger('rgw-invalidate');
712
-
713
- $('.rg-vertical-tab').click(function() {
714
- saveContent(auth, $('.rg-preview-widget-container'), true);
715
-
716
- $('.rg-vertical-tab').removeClass('active');
717
- $(this).addClass('active');
718
- view = VIEW_TYPE[$(this).attr('tab')];
719
- if (auth.view.currentView != view) { auth.view.switchView(view); }
720
-
721
- $('.rg-preview-widget, .content-warp').scrollTop(10000);
722
- });
723
-
724
- enableContentEditable(auth, $('.rg-preview-widget-container'));
725
- restoreContent(auth, $('.rg-preview-widget-container'));
726
-
727
- $('.save').click(function() {
728
- $('.save').css('opacity', 0.4);
729
- saveContent(auth, $('.rg-preview-widget-container'), false);
730
- });
731
-
732
- window.refresh_readygraph = function() {
733
- restoreContent(auth, $('.rg-preview-widget-container'));
734
- }
735
- });
736
- });
737
- });
738
- });
739
- }
740
- function enableContentEditable(model, container) {
741
- model.view.$el.find('[rgw-data-key]').each(function() {
742
- var element = $(this);
743
- if (element.attr('rgw-data-editable') == 'false') return;
744
-
745
- if (element.attr('editing') != null) return;
746
- container.find('.special-button-container button').attr('disabled', 'disabled');
747
- element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
748
- element.attr('editing', '1');
749
- element.css({
750
- 'border': '2px dashed orange',
751
- 'position': 'relative',
752
- 'top': '-2px',
753
- 'margin-bottom': '-4px',
754
- 'background-color': '#FAFAC5'
755
- });
756
- element.attr('contenteditable', true);
757
- element.bind('paste', function(e) {
758
- e.preventDefault();
759
- });
760
- element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
761
- });
762
- }
763
- function saveContent(model, container, fake) {
764
- var settings = {};
765
- model.view.$el.find('[rgw-data-key]').each(function() {
766
- var element = $(this);
767
- if (element.attr('rgw-data-editable') == 'false') return;
768
- settings[element.attr('rgw-data-key')] = element.text();
769
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
770
- });
771
- if (!fake) {
772
- $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
773
- $('#myForm')[0].submit();
774
- }
775
- }
776
- function restoreContent(model, container) {
777
- eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
778
- var settings = window._TEMP;
779
- if (settings) {
780
- model.view.$el.find('[rgw-data-key]').each(function() {
781
- var element = $(this);
782
- if (element.attr('rgw-data-editable') == 'false') return;
783
- element.text(settings[element.attr('rgw-data-key')]);
784
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
785
- });
786
- }
787
- }
788
- </script>
789
- <style>
790
- /* FOR INLINE WIDGET */
791
- .rgw-overlay {
792
- display: none !important;
793
- }
794
- .rgw-content-frame {
795
- left: 0 !important;
796
- top: 0 !important;
797
- position: relative !important;
798
- margin: 0 auto !important;
799
- border: solid 1px #cccccc;
800
- }
801
- .rgw-preview-warning {
802
- display: none !important;
803
- }
804
- .rgw-content {
805
- position: relative !important;
806
- }
807
- </style>
12
  * @copyright 2014 Your Name or Company Name
13
  */
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']);
30
  if (isset($_POST["site_category"])) update_option('readygraph_site_category', $_POST["site_category"]);
31
  if (isset($_POST["site_language"])) update_option('readygraph_site_language', $_POST["site_language"]);
32
  if ($_SERVER['REQUEST_METHOD'] === 'POST') {
33
+ s2_siteprofile_sync();
34
  }
35
  }
36
  if(isset($_GET["readygraph_plan"]) && $_GET["readygraph_plan"] != ""){update_option('readygraph_plan',$_GET["readygraph_plan"]);}
37
 
38
  ?>
39
 
40
+
 
41
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
42
  <script type="text/javascript" src="<?php echo plugins_url( 'assets/js/jquery.dependent-selects.js', __FILE__ ) ?>"></script>
43
  <script type="text/javascript" charset="utf-8">
55
  <input type="hidden" name="readygraph_application_id" value="<?php echo get_option('readygraph_application_id', '') ?>">
56
  <input type="hidden" name="readygraph_site_category" value="<?php echo get_option('readygraph_site_category', '') ?>">
57
  <input type="hidden" name="readygraph_site_language" value="<?php echo get_option('readygraph_site_language', '') ?>">
58
+ <div><div><a href="#">Basic Settings</a> > Site Profile</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>
341
  </div>
342
  </div>
343
  </form>
 
344
 
345
  <script type="text/javascript" charset="utf-8">
346
  var $ = jQuery;
353
  $('#site_language').val(language);
354
  }
355
  </script>
356
+ <?php include("footer.php"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
extension/readygraph/social-feed.php CHANGED
@@ -11,24 +11,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
  if(isset($_GET["readygraph_upgrade_notice"]) && $_GET["readygraph_upgrade_notice"] == "dismiss") {update_option('readygraph_upgrade_notice', 'false');}
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,83 +48,12 @@ 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
-
102
- <div class="readygraph-nav-menu">
103
- <ul><li>Grow Users
104
- <ul>
105
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=signup-popup">Signup Popup</a></li>
106
- <li><a href="https://readygraph.com/application/insights/" target="_blank">User Statistics</a></li>
107
- <li><a href="#"></a></li>
108
- </ul>
109
- </li>
110
- <li>Email Users
111
- <ul>
112
- <li><a href="https://readygraph.com/application/customize/settings/email/welcome/" target="_blank">Retention Email</a></li>
113
- <li><a href="https://readygraph.com/application/customize/settings/email/invitation/" target="_blank">Invitation Email</a></li>
114
- <li><a href="http://readygraph.com/application/insights/" target="_blank">Custom Email</a></li>
115
- </ul>
116
- </li>
117
- <li>
118
- Engage Users
119
- <ul>
120
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=social-feed">Social Feed</a></li>
121
- <li><a href="#">Social Followers</a></li>
122
- <li><a href="#">Feedback Survey</a></li>
123
- </ul>
124
- </li>
125
- <li>Basic Settings
126
- <ul>
127
- <li><a href="<?php $current_url = explode("&", $_SERVER['REQUEST_URI']); echo $current_url[0];?>&ac=site-profile">Site Profile</a></li>
128
- <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>
129
- </ul>
130
- </li>
131
- </ul>
132
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
133
- <p><a href="mailto:info@readygraph.com" style="color: #b1c1ca" >Help <img src="<?php echo plugin_dir_url( __FILE__ );?>assets/9.png"/></a></p>
134
- </div>
135
- <div class="btn-group" style="margin: 8px 10px 0 10px;">
136
- <p>
137
- <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>
138
- </div>
139
- <div class="btn-group" style="">
140
- <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>
141
- </div>
142
- </div>
143
  <div><a href="#">Engage Users</a> > Social Feed</div>
144
  <?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>
145
  <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>
@@ -168,369 +82,5 @@ s2_rrmdir($dir);
168
 
169
  </div>
170
  </div>
171
- </div>
172
  </form>
173
- <script type="text/javascript" src="https://readygraph.com/scripts/readygraph.js"></script>
174
- <script type="text/javascript" charset="utf-8">
175
- var $ = jQuery;
176
- $(function () {
177
- var settings =
178
- {
179
- 'host': "www.readygraph.com"
180
- , 'clientId': "9838eb84c6da2fc44ab9"
181
- };
182
-
183
- var authHost = "https://" + settings.host;
184
- var resourceHost = "https://" + settings.host;
185
-
186
- // OAuth 2.0 Popup
187
- //
188
- var popupWindow=null;
189
- function openPopup(url)
190
- {
191
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
192
- 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);
193
- }
194
- function parent_disable() {
195
- if(popupWindow && !popupWindow.closed) popupWindow.focus();
196
- }
197
-
198
- $("a.connect").click(function() {
199
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
200
- openPopup(url);
201
- $(document.body).bind('focus', parent_disable);
202
- $(document.body).bind('click', parent_disable);
203
- });
204
- $(".change-account").click(function() {
205
- var url = authHost + '/oauth/authenticate?client_id=' + settings.clientId + '&redirect_uri=' + encodeURIComponent(location.href.replace('#' + location.hash,"")) + '&response_type=token';
206
- var logout = authHost + '/oauth/logout?redirect=' + encodeURIComponent(url);
207
- openPopup(logout);
208
- $(document.body).bind('focus', parent_disable);
209
- $(document.body).bind('click', parent_disable);
210
- });
211
-
212
- // User Interface
213
- //
214
- $('.template').click(function() {
215
- $('#preview').attr('src', $(this).find('img').attr('src'));
216
- });
217
-
218
- // Manage OAuth 2.0 Redirect
219
- //
220
- var extractCode = function(hash) {
221
- var match = hash.match(/code=(\w+)/);
222
- return !!match && match[1];
223
- };
224
- var extractToken = function(hash) {
225
- var match = hash.match(/access_token=(\w+)/);
226
- return !!match && match[1];
227
- };
228
- var extractError = function(hash) {
229
- var match = hash.match(/error=(\w+)/);
230
- return !!match && match[1];
231
- };
232
-
233
- var code = extractCode(window.location.href);
234
- if (extractError(window.location.href) == 'access_denied') {
235
- window.close();
236
- }
237
- else if(code) {
238
- try { window.opener.setCode(code); }
239
- catch(ex) { }
240
- window.close();
241
- }
242
- else {
243
- $('.rgw-fb-login-button-iframe').hide();
244
- $('div.authenticate').show();
245
-
246
- if ($('[name="readygraph_access_token"]').val()) {
247
- $('.rgw-fb-login-button-iframe').show();
248
- $('div.authenticate').hide();
249
- $('div.authenticating').hide();
250
- $('div.authenticated').show();
251
-
252
- $('.email-address').text($('[name="readygraph_email"]').val());
253
-
254
- window.setup_readygraph($('[name="readygraph_application_id"]').val());
255
- $('.sidebar').val($('[name="readygraph_enable_sidebar"]').val());
256
-
257
- //$('[name="readygraph_ad_format"][value="' + $('[name="_readygraph_ad_format"]').val() + '"]').parent().click();
258
- //$('[name="readygraph_ad_timing"][value="' + $('[name="_readygraph_ad_timing"]').val() + '"]').parent().click();
259
-
260
- //$('[name="readygraph_ad_delay"]').val($('[name="_readygraph_ad_delay"]').val());
261
- //$('[name="readygraph_ad_scroll"]').val($('[name="_readygraph_ad_scroll"]').val());
262
-
263
- $('.result').text('...');
264
- if ($('[name="readygraph_access_token"]').val()) {
265
- $.ajax({
266
- url: resourceHost + '/api/v1/insight_info'
267
- , beforeSend: function (xhr) {
268
- xhr.setRequestHeader('Authorization', "Bearer " + $('[name="readygraph_access_token"]').val());
269
- xhr.setRequestHeader('Accept', "application/json");
270
- }
271
- , method: 'POST'
272
- , success: function (response) {
273
- if (response.data) {
274
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
275
- } else {
276
- $('.result').text('Insight');
277
- }
278
- }
279
- , error: function (response) {
280
- refresh_access_token();
281
- }
282
- });
283
- }
284
- }
285
- }
286
-
287
- // Manage OAuth 2.0 Results
288
- //
289
- function refresh_access_token() {
290
- var refresh_token = $('[name="readygraph_refresh_token"]').val();
291
- if (refresh_token) {
292
- $('div.authenticate').hide();
293
- $('div.authenticating').show();
294
- $('div.authenticated').hide();
295
-
296
- $.ajax({
297
- url: resourceHost + '/oauth/access_token'
298
- , data: {
299
- grant_type: 'refresh_token',
300
- refresh_token: $('[name="readygraph_refresh_token"]').val(),
301
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
302
- client_id: settings.clientId
303
- }
304
- , method: 'POST'
305
- , success: function (response) {
306
- $('[name="readygraph_access_token"]').val(response.access_token);
307
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
308
- window.setAccessToken(response.access_token);
309
- $('.result').text(response.data.subscribers + ((response.data.subscribers == 0) ? ' Subscriber' : ' Subscribers'));
310
- }
311
- , error: function (response) {
312
- alert('We couldn\'t authenticate your account. Please check your internet connection.');
313
- $('div.authenticate').show();
314
- $('div.authenticating').hide();
315
- $('div.authenticated').hide();
316
- }
317
- });
318
- }
319
- }
320
- window.setCode = function(code) {
321
- $('.rgw-fb-login-button-iframe').hide();
322
- $('div.authenticate').hide();
323
- $('div.authenticating').show();
324
- $('div.authenticated').hide();
325
-
326
- $.ajax({
327
- url: resourceHost + '/oauth/access_token'
328
- , data: {
329
- grant_type: 'authorization_code',
330
- code: code,
331
- redirect_uri: encodeURIComponent(location.href.replace('#' + location.hash,"")),
332
- client_id: settings.clientId
333
- }
334
- , method: 'POST'
335
- , success: function (response) {
336
- if (response) {
337
- $('[name="readygraph_access_token"]').val(response.access_token);
338
- $('[name="readygraph_refresh_token"]').val(response.refresh_token);
339
- window.setAccessToken(response.access_token);
340
- } else {
341
- $('div.authenticating').hide();
342
- $('div.authenticate').show();
343
- }
344
- }
345
- });
346
- }
347
- window.setAccessToken = function(token) {
348
- $('.rgw-fb-login-button-iframe').hide();
349
- $('div.authenticate').hide();
350
- $('div.authenticating').show();
351
- $('div.authenticated').hide();
352
-
353
- $.ajax({
354
- url: resourceHost + '/api/v1/account_info'
355
- , beforeSend: function (xhr) {
356
- xhr.setRequestHeader('Authorization', "Bearer " + token);
357
- xhr.setRequestHeader('Accept', "application/json");
358
- }
359
- , method: 'POST'
360
- , success: function (response) {
361
- if (response.data) {
362
- $('[name="readygraph_access_token"]').val(token);
363
- $('[name="readygraph_email"]').val(response.data.email);
364
- $('[name="readygraph_application_id"]').val(response.data.application_id);
365
- $('#myForm')[0].submit();
366
- } else {
367
- $('div.authenticating').hide();
368
- $('div.authenticate').show();
369
- $('.rgw-fb-login-button-iframe').hide();
370
- }
371
- }
372
- });
373
- }
374
- });
375
- </script>
376
- <script>
377
- window.setup = false;
378
- window.refresh_readygraph = function() {};
379
- window.setup_readygraph = function(app_id) {
380
- if (window.setup) {
381
- window.refresh_readygraph();
382
- return;
383
- }
384
- window.setup = true;
385
- readygraph.setup({
386
- applicationId: app_id,
387
- isPreview: true,
388
- enableLoginWall: false,
389
- enableDistraction: false,
390
- enableAutoLogin: false,
391
- enableSidebar: false,
392
- enableNotification: false,
393
- enableInvite: false,
394
- enableOpenGraph: false,
395
- enableRgSeo: false
396
- });
397
- readygraph.ready(function() {
398
- readygraph.framework.require(['compact.sdk', 'facebook.sdk'], function() {
399
- var $ = readygraph.framework.jQuery;
400
- $.cookie('RGAuth', null);
401
- readygraph.framework.facebook.logout(function() {
402
- readygraph.framework.require(['invite'], function() {
403
- var VIEW_TYPE = {
404
- LOADING: 0,
405
- LOGIN_REQUIRE: 1,
406
- PERMISSION_REQUIRE: 2,
407
- DEFAULT: 3,
408
- LOGIN_WITH_EMAIL: 4,
409
- SIGNUP_WITH_EMAIL: 5,
410
- IMPORT_WITH_EMAIL: 6,
411
- FINISH: 10
412
- };
413
-
414
- var auth = new readygraph.framework.ui.AuthModel({
415
- dialog: true,
416
- 'inviter_profile_picture': 'https://graph.facebook.com/4/picture?type=normal&width=400&height=400'
417
- });
418
- $('.rg-preview-widget').html('');
419
- $('.rg-preview-widget').append(auth.lightbox.view.$el);
420
- $('.rgw-content').attr('style', 'position: relative !important;');
421
-
422
- var view = VIEW_TYPE.LOGIN_REQUIRE;
423
- auth.on('switch', function() {
424
- if (auth.view.currentView != view) { auth.view.switchView(view); }
425
- else auth.view.render();
426
- if (view == VIEW_TYPE.DEFAULT) {
427
- auth.view.$el.find('.rgw-invite-view').showAndAnimate();
428
- auth.view.$el.find('.rgw-follow-view').hideAndAnimate();
429
- auth.view.$el.commitTransition();
430
- }
431
- });
432
- auth.view.switchView(view);
433
-
434
- $(window).scroll(function() {
435
- $(window).trigger('rgw-invalidate');
436
- });
437
- $('.rg-preview-widget, .content-warp').scroll(function() {
438
- $(window).trigger('rgw-invalidate');
439
- });
440
- $(window).trigger('rgw-invalidate');
441
-
442
- $('.rg-vertical-tab').click(function() {
443
- saveContent(auth, $('.rg-preview-widget-container'), true);
444
-
445
- $('.rg-vertical-tab').removeClass('active');
446
- $(this).addClass('active');
447
- view = VIEW_TYPE[$(this).attr('tab')];
448
- if (auth.view.currentView != view) { auth.view.switchView(view); }
449
-
450
- $('.rg-preview-widget, .content-warp').scrollTop(10000);
451
- });
452
-
453
- enableContentEditable(auth, $('.rg-preview-widget-container'));
454
- restoreContent(auth, $('.rg-preview-widget-container'));
455
-
456
- $('.save').click(function() {
457
- $('.save').css('opacity', 0.4);
458
- saveContent(auth, $('.rg-preview-widget-container'), false);
459
- });
460
-
461
- window.refresh_readygraph = function() {
462
- restoreContent(auth, $('.rg-preview-widget-container'));
463
- }
464
- });
465
- });
466
- });
467
- });
468
- }
469
- function enableContentEditable(model, container) {
470
- model.view.$el.find('[rgw-data-key]').each(function() {
471
- var element = $(this);
472
- if (element.attr('rgw-data-editable') == 'false') return;
473
-
474
- if (element.attr('editing') != null) return;
475
- container.find('.special-button-container button').attr('disabled', 'disabled');
476
- element.text(readygraph.getSettings().get(element.attr('rgw-data-key')));
477
- element.attr('editing', '1');
478
- element.css({
479
- 'border': '2px dashed orange',
480
- 'position': 'relative',
481
- 'top': '-2px',
482
- 'margin-bottom': '-4px',
483
- 'background-color': '#FAFAC5'
484
- });
485
- element.attr('contenteditable', true);
486
- element.bind('paste', function(e) {
487
- e.preventDefault();
488
- });
489
- element.bind('keydown', function() { $('.save').css('opacity', '1.0'); });
490
- });
491
- }
492
- function saveContent(model, container, fake) {
493
- var settings = {};
494
- model.view.$el.find('[rgw-data-key]').each(function() {
495
- var element = $(this);
496
- if (element.attr('rgw-data-editable') == 'false') return;
497
- settings[element.attr('rgw-data-key')] = element.text();
498
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
499
- });
500
- if (!fake) {
501
- $('input[name="readygraph_settings"]').val(JSON.stringify(settings));
502
- $('#myForm')[0].submit();
503
- }
504
- }
505
- function restoreContent(model, container) {
506
- eval('window._TEMP='+$('input[name="readygraph_settings"]').val());
507
- var settings = window._TEMP;
508
- if (settings) {
509
- model.view.$el.find('[rgw-data-key]').each(function() {
510
- var element = $(this);
511
- if (element.attr('rgw-data-editable') == 'false') return;
512
- element.text(settings[element.attr('rgw-data-key')]);
513
- readygraph.getSettings().set(element.attr('rgw-data-key'), element.text());
514
- });
515
- }
516
- }
517
- </script>
518
- <style>
519
- /* FOR INLINE WIDGET */
520
- .rgw-overlay {
521
- display: none !important;
522
- }
523
- .rgw-content-frame {
524
- left: 0 !important;
525
- top: 0 !important;
526
- position: relative !important;
527
- margin: 0 auto !important;
528
- border: solid 1px #cccccc;
529
- }
530
- .rgw-preview-warning {
531
- display: none !important;
532
- }
533
- .rgw-content {
534
- position: relative !important;
535
- }
536
- </style>
11
  * @link http://www.readygraph.com
12
  * @copyright 2014 Your Name or Company Name
13
  */
14
+ include("header.php");
 
 
 
 
 
 
 
 
 
 
 
 
15
 
 
 
16
  if(isset($_GET["readygraph_upgrade_notice"]) && $_GET["readygraph_upgrade_notice"] == "dismiss") {update_option('readygraph_upgrade_notice', 'false');}
 
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']);
48
  }
49
  }
50
  ?>
 
 
 
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
  <input type="hidden" name="readygraph_enable_sidebar" value="<?php echo get_option('readygraph_enable_sidebar', 'false') ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  <div><a href="#">Engage Users</a> > Social Feed</div>
58
  <?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>
59
  <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>
82
 
83
  </div>
84
  </div>
 
85
  </form>
86
+ <?php include("footer.php"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readygraph-extension.php CHANGED
@@ -1,16 +1,18 @@
1
  <?php
2
  // Extension Configuration
3
- //
4
- $plugin_slug = basename(dirname(__FILE__));
5
- $menu_slug = 'readygraph-app';
6
- $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
- global $wpdb;
 
13
  $email = $_POST['email'];
 
 
14
  if (class_exists('s2class')){
15
  $s2class_instance = new s2class();
16
  $s2class_instance->ip = $_SERVER['REMOTE_ADDR'];
@@ -18,29 +20,123 @@ function s2_myajax_submit() {
18
  $s2class_instance->add( $email );
19
  }
20
  wp_die();
21
-
22
  }
23
 
24
- // ReadyGraph Engine Hooker
25
- //
26
- include_once('extension/readygraph/extension.php');
27
-
28
- function on_plugin_activated_readygraph_s2_redirect(){
29
-
30
- global $menu_slug;
31
- $setting_url="admin.php?page=$menu_slug";
32
- if (get_option('rg_s2_plugin_do_activation_redirect', false)) {
33
- delete_option('rg_s2_plugin_do_activation_redirect');
34
- wp_redirect(admin_url($setting_url));
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
 
37
 
38
- // remove_action('admin_init', 'on_plugin_activated_redirect');
39
-
40
- // add_action('admin_menu', 'add_readygraph_admin_menu_option');
41
- add_action('admin_notices', 'add_s2_readygraph_plugin_warning');
42
- add_action('wp_footer', 'readygraph_client_script_head');
43
- add_action('admin_init', 'on_plugin_activated_readygraph_s2_redirect');
44
  add_option('readygraph_connect_notice','true');
45
 
46
  function rg_s2_popup_options_enqueue_scripts() {
@@ -65,88 +161,107 @@ function rg_s2_popup_options_enqueue_scripts() {
65
  if ( get_option('readygraph_popup_template') == 'yellow-template' ) {
66
  wp_enqueue_style( 'yellow-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/yellow-popup.css' );
67
  }
68
- if ( get_option('readygraph_popup_template') == 'custom-template' ) {
69
-
70
  wp_enqueue_style( 'custom-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/custom-popup.css' );
71
  }
72
  }
73
- add_action( 'admin_enqueue_scripts', 'rg_s2_popup_options_enqueue_scripts' );
74
- add_action( 'wp_enqueue_scripts', 'rg_s2_popup_options_enqueue_scripts' );
75
- add_action( 'admin_enqueue_scripts', 'rg_s2_enqueue_color_picker' );
76
-
77
- function rg_s2_enqueue_color_picker( $hook_suffix ) {
78
- // first check that $hook_suffix is appropriate for your admin page
79
- wp_enqueue_style( 'wp-color-picker' );
80
- wp_enqueue_script( 's2-script-handle', plugins_url('/extension/readygraph/assets/js/my-script.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
81
- }
82
 
83
  function s2_post_updated_send_email( $post_id ) {
84
-
85
  // If this is just a revision, don't send the email.
86
- if ( wp_is_post_revision( $post_id ) )
87
- return;
88
  if(get_option('readygraph_application_id') && strlen(get_option('readygraph_application_id')) > 0 && get_option('readygraph_send_blog_updates') == "true"){
89
-
90
- $post_title = get_the_title( $post_id );
91
- $post_url = get_permalink( $post_id );
92
- $post_image = wp_get_attachment_url(get_post_thumbnail_id($post_id));
93
- $post_content = get_post($post_id);
94
- $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);
95
- $url = 'http://readygraph.com/api/v1/post.json/';
96
- if (get_option('readygraph_send_real_time_post_updates')=='true'){
97
- $response = wp_remote_post($url, array( 'body' => array('is_wordpress'=>1, 'is_realtime'=>1, 'message' => $post_title, 'message_link' => $post_url,'message_excerpt' => $post_excerpt,'client_key' => get_option('readygraph_application_id'), 'email' => get_option('readygraph_email'))));
98
- }
99
- else {
100
- $response = wp_remote_post($url, array( 'body' => array('is_wordpress'=>1, 'message' => $post_title, 'message_link' => $post_url,'message_excerpt' => $post_excerpt,'client_key' => get_option('readygraph_application_id'), 'email' => get_option('readygraph_email'))));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  }
102
- if ( is_wp_error( $response ) ) {
103
- $error_message = $response->get_error_message();
 
 
104
 
105
- } else {
106
 
 
 
 
107
  }
108
- $app_id = get_option('readygraph_application_id');
109
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=post_created&app_id=$app_id" );
110
- }
111
- else{
112
- }
113
-
114
- }
115
- add_action('future_to_publish','s2_post_updated_send_email');
116
- add_action('new_to_publish','s2_post_updated_send_email');
117
- add_action('draft_to_publish','s2_post_updated_send_email');
118
- //add_action( 'publish_post', 's2_post_updated_send_email' );
119
- //add_action( 'publish_page', 's2_post_updated_send_email' );
120
-
121
- if(get_option('s2_wordpress_sync_users')){}
122
- else{
123
- add_action('plugins_loaded', 'rg_s2_get_version');
124
- }
125
- function rg_s2_get_version() {
126
- if(get_option('s2_wordpress_sync_users') && get_option('s2_wordpress_sync_users') == "true")
127
- {}
128
  else {
129
  if(get_option('readygraph_application_id') && strlen(get_option('readygraph_application_id')) > 0){
130
- s2_wordpress_sync_users(get_option('readygraph_application_id'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  }
132
  }
133
  }
134
- function s2_wordpress_sync_users( $app_id ){
135
- global $wpdb;
136
- $query = "SELECT email as email, date as user_date FROM {$wpdb->prefix}subscribe2 ";
137
- $subscribe2_users = $wpdb->get_results($query);
138
- $emails = "";
139
- $dates = "";
140
- $count = 0;
141
- $count = mysql_num_rows($subscribe2_users);
142
- wp_remote_get( "http://readygraph.com/api/v1/tracking?event=wp_user_synced&app_id=$app_id&count=$count" );
143
- foreach($subscribe2_users as $user) {
144
- $emails .= $user->email . ",";
145
- $dates .= $user->user_date . ",";
 
146
  }
147
- $url = 'https://readygraph.com/api/v1/wordpress-sync-enduser/';
148
- $response = wp_remote_post($url, array( 'body' => array('app_id' => $app_id, 'email' => rtrim($emails, ", "), 'user_registered' => rtrim($dates, ", "))));
149
- update_option('s2_wordpress_sync_users',"true");
150
- remove_action('plugins_loaded', 'rg_s2_get_version');
151
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  ?>
1
  <?php
2
  // Extension Configuration
3
+ $s2_plugin_slug = basename(dirname(__FILE__));
4
+ $s2_menu_slug = 'readygraph-app';
5
+ $s2_main_plugin_title = 'Subscribe2';
 
6
 
7
  add_action( 'wp_ajax_nopriv_s2-myajax-submit', 's2_myajax_submit' );
8
  add_action( 'wp_ajax_s2-myajax-submit', 's2_myajax_submit' );
9
 
10
  function s2_myajax_submit() {
11
+ if ($_POST['adsoptimal_id']) update_option('readygraph_adsoptimal_id',$_POST['adsoptimal_id']);
12
+ if ($_POST['adsoptimal_secret']) update_option('readygraph_adsoptimal_secret',$_POST['adsoptimal_secret']);
13
  $email = $_POST['email'];
14
+ if ($email){
15
+ global $wpdb;
16
  if (class_exists('s2class')){
17
  $s2class_instance = new s2class();
18
  $s2class_instance->ip = $_SERVER['REMOTE_ADDR'];
20
  $s2class_instance->add( $email );
21
  }
22
  wp_die();
23
+ }
24
  }
25
 
26
+ // ReadyGraph Engine Hooker
27
+
28
+ include_once('extension/readygraph/extension.php');
29
+
30
+ function on_plugin_activated_readygraph_s2_redirect(){
31
+ global $s2_menu_slug;
32
+ $setting_url="admin.php?page=$s2_menu_slug";
33
+ if (get_option('rg_s2_plugin_do_activation_redirect', false)) {
34
+ delete_option('rg_s2_plugin_do_activation_redirect');
35
+ wp_redirect(admin_url($setting_url));
36
+ }
37
+ }
38
+
39
+ function add_s2_readygraph_plugin_warning() {
40
+ if (get_option('readygraph_access_token', '') != '') return;
41
+ global $hook_suffix, $current_user, $s2_menu_slug;
42
+ if(isset($_GET["readygraph_notice"]) && $_GET["readygraph_notice"] == "dismiss") update_option('readygraph_connect_notice','false');
43
+ if ( $hook_suffix == 'plugins.php' && get_option('readygraph_connect_notice') == 'true' ) {
44
+ echo '<div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
45
+ <style type="text/css">
46
+ .readygraph_activate {
47
+ min-width:825px;
48
+ padding:7px;
49
+ margin:15px 0;
50
+ background:#1b75bb;
51
+ -moz-border-radius:3px;
52
+ border-radius:3px;
53
+ -webkit-border-radius:3px;
54
+ position:relative;
55
+ overflow:hidden;
56
+ }
57
+ .readygraph_activate .aa_button {
58
+ cursor: pointer;
59
+ -moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
60
+ -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
61
+ box-shadow:inset 0px 1px 0px 0px #ffffff;
62
+ background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #f9f9f9), color-stop(1, #e9e9e9) );
63
+ background:-moz-linear-gradient( center top, #f9f9f9 5%, #e9e9e9 100% );
64
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#f9f9f9", endColorstr="#e9e9e9");
65
+ background-color:#f9f9f9;
66
+ -webkit-border-top-left-radius:3px;
67
+ -moz-border-radius-topleft:3px;
68
+ border-top-left-radius:3px;
69
+ -webkit-border-top-right-radius:3px;
70
+ -moz-border-radius-topright:3px;
71
+ border-top-right-radius:3px;
72
+ -webkit-border-bottom-right-radius:3px;
73
+ -moz-border-radius-bottomright:3px;
74
+ border-bottom-right-radius:3px;
75
+ -webkit-border-bottom-left-radius:3px;
76
+ -moz-border-radius-bottomleft:3px;
77
+ border-bottom-left-radius:3px;
78
+ text-indent:0;
79
+ border:1px solid #dcdcdc;
80
+ display:inline-block;
81
+ color:#333333;
82
+ font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
83
+ font-size:15px;
84
+ font-weight:normal;
85
+ font-style:normal;
86
+ height:40px;
87
+ line-height:40px;
88
+ width:275px;
89
+ text-decoration:none;
90
+ text-align:center;
91
+ text-shadow:1px 1px 0px #ffffff;
92
+ }
93
+ .readygraph_activate .aa_button:hover {
94
+ background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #e9e9e9), color-stop(1, #f9f9f9) );
95
+ background:-moz-linear-gradient( center top, #e9e9e9 5%, #f9f9f9 100% );
96
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#e9e9e9", endColorstr="#f9f9f9");
97
+ background-color:#e9e9e9;
98
+ }
99
+ .readygraph_activate .aa_button:active {
100
+ position:relative;
101
+ top:1px;
102
+ }
103
+ /* This button was generated using CSSButtonGenerator.com */
104
+ .readygraph_activate .aa_description {
105
+ position:absolute;
106
+ top:19px;
107
+ left:285px;
108
+ margin-left:25px;
109
+ color:#ffffff;
110
+ font-size:15px;
111
+ z-index:1000
112
+ }
113
+ .readygraph_activate .aa_description strong {
114
+ color:#FFF;
115
+ font-weight:normal
116
+ }
117
+ .aa_close {
118
+ position: absolute;
119
+ right: 18px;
120
+ top: 18px;
121
+ }
122
+ </style>
123
+ <form name="readygraph_activate" action="'.admin_url( 'admin.php?page=' . $s2_menu_slug).'" method="POST">
124
+ <input type="hidden" name="return" value="1"/>
125
+ <div class="readygraph_activate">
126
+ <div class="aa_button" onclick="document.readygraph_activate.submit();">
127
+ '.__('Connect Your ReadyGraph Account').'
128
+ </div>
129
+ <div class="aa_description">'.__('<strong>Almost done</strong> - connect your account to start getting users.').'</div>
130
+ <div class="aa_close"><a href="' . $_SERVER["PHP_SELF"] . '?readygraph_notice=dismiss"><img src="'.plugin_dir_url( __FILE__ ).'assets/dialog_close.png"></a></div>
131
+ </div>
132
+ </form>
133
+ </div>';
134
  }
135
+ }
136
 
137
+ add_action('admin_notices', 'add_s2_readygraph_plugin_warning');
138
+ add_action('wp_footer', 's2_readygraph_client_script_head', 5);
139
+ add_action('admin_init', 'on_plugin_activated_readygraph_s2_redirect');
 
 
 
140
  add_option('readygraph_connect_notice','true');
141
 
142
  function rg_s2_popup_options_enqueue_scripts() {
161
  if ( get_option('readygraph_popup_template') == 'yellow-template' ) {
162
  wp_enqueue_style( 'yellow-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/yellow-popup.css' );
163
  }
164
+ if ( get_option('readygraph_popup_template') == 'custom-template' ) {
 
165
  wp_enqueue_style( 'custom-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/custom-popup.css' );
166
  }
167
  }
168
+ add_action( 'admin_enqueue_scripts', 'rg_s2_popup_options_enqueue_scripts' );
169
+ add_action( 'wp_enqueue_scripts', 'rg_s2_popup_options_enqueue_scripts' );
 
 
 
 
 
 
 
170
 
171
  function s2_post_updated_send_email( $post_id ) {
 
172
  // If this is just a revision, don't send the email.
173
+ if ( wp_is_post_revision( $post_id ) ) return;
 
174
  if(get_option('readygraph_application_id') && strlen(get_option('readygraph_application_id')) > 0 && get_option('readygraph_send_blog_updates') == "true"){
175
+ $post_title = get_the_title( $post_id );
176
+ $post_url = get_permalink( $post_id );
177
+ $post_content = get_post($post_id);
178
+ $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);
179
+ $attachments = get_children(array('post_parent' => $post_id,
180
+ 'post_status' => 'inherit',
181
+ 'post_type' => 'attachment',
182
+ 'post_mime_type' => 'image',
183
+ 'order' => 'ASC',
184
+ 'orderby' => 'menu_order ID'));
185
+ $images_list = array();
186
+ foreach($attachments as $att_id => $attachment) {
187
+ $full_img_url = wp_get_attachment_url($attachment->ID);
188
+ $images_list[] = $full_img_url;
189
+ // Your Code here
190
+ }
191
+ $post_image = reset($arr);
192
+ $url = 'http://readygraph.com/api/v1/post.json/';
193
+ $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'))));
194
+ if ( is_wp_error( $response ) ) {
195
+ $error_message = $response->get_error_message();
196
+ } else {
197
+ }
198
+ $app_id = get_option('readygraph_application_id');
199
+ wp_remote_get( "http://readygraph.com/api/v1/tracking?event=post_created&app_id=$app_id" );
200
+ } else {
201
  }
202
+ }
203
+ add_action('future_to_publish','s2_post_updated_send_email');
204
+ add_action('new_to_publish','s2_post_updated_send_email');
205
+ add_action('draft_to_publish','s2_post_updated_send_email');
206
 
 
207
 
208
+ if(get_option('s2_wordpress_sync_users')) return;
209
+ else {
210
+ add_action('plugins_loaded', 's2_wordpress_sync_users');
211
  }
212
+ function s2_wordpress_sync_users() {
213
+ if(get_option('s2_wordpress_sync_users') && get_option('s2_wordpress_sync_users') == "true") return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  else {
215
  if(get_option('readygraph_application_id') && strlen(get_option('readygraph_application_id')) > 0){
216
+ global $wpdb;
217
+ $app_id = get_option('readygraph_application_id');
218
+ $query = "SELECT email as email, date as user_date FROM {$wpdb->prefix}subscribe2 ";
219
+ $subscribe2_users = $wpdb->get_results($query);
220
+ $emails = "";
221
+ $dates = "";
222
+ $count = 0;
223
+ $count = mysql_num_rows($subscribe2_users);
224
+ wp_remote_get( "http://readygraph.com/api/v1/tracking?event=wp_user_synced&app_id=$app_id&count=$count" );
225
+ foreach($subscribe2_users as $user) {
226
+ $emails .= $user->email . ",";
227
+ $dates .= $user->user_date . ",";
228
+ }
229
+ $url = 'https://readygraph.com/api/v1/wordpress-sync-enduser/';
230
+ $response = wp_remote_post($url, array( 'body' => array('app_id' => $app_id, 'email' => rtrim($emails, ", "), 'user_registered' => rtrim($dates, ", "))));
231
+ update_option('s2_wordpress_sync_users',"true");
232
+ remove_action('plugins_loaded', 's2_wordpress_sync_users');
233
  }
234
  }
235
  }
236
+ function s2_rg_connect(){
237
+ if(get_option('readygraph_connect_anonymous') != "true"){
238
+ $url = 'https://readygraph.com/api/v1/wordpress-rg-connect-anonymous/';
239
+ $randon_string = s2_get_random_string();
240
+ $response = wp_remote_post($url, array( 'body' => array('app_secret' => $randon_string, 'website' => home_url())));
241
+ if ( is_wp_error( $response ) ) {
242
+ $error_message = $response->get_error_message();
243
+ } else {
244
+ $result = json_decode($response['body'],true);
245
+ $app_id = $result['data']['app_id'];
246
+ update_option('readygraph_connect_anonymous', 'true');
247
+ update_option('readygraph_application_id', $app_id);
248
+ update_option('readygraph_connect_anonymous_app_secret', $randon_string);
249
  }
 
 
 
 
250
  }
251
+ }
252
+ function s2_get_random_string()
253
+ {
254
+ $valid_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
255
+ $length = 10;
256
+ $random_string = "";
257
+ $num_valid_chars = strlen($valid_chars);
258
+ for ($i = 0; $i < $length; $i++)
259
+ {
260
+ $random_pick = mt_rand(1, $num_valid_chars);
261
+ $random_char = $valid_chars[$random_pick-1];
262
+ $random_string .= $random_char;
263
+ }
264
+ return $random_string;
265
+ }
266
+
267
  ?>
subscribe2.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Subscribe2
4
  Plugin URI: http://subscribe2.wordpress.com
5
  Description: Notifies an email list when new entries are posted.
6
- Version: 10.19.0
7
  Author: Matthew Robinson, Tanay Lakhani
8
  Author URI: http://subscribe2.wordpress.com
9
  Licence: GPL3
@@ -55,7 +55,7 @@ if ( is_plugin_active_for_network(plugin_basename(__FILE__)) ) {
55
 
56
  // our version number. Don't touch this or any line below
57
  // unless you know exactly what you are doing
58
- define( 'S2VERSION', '10.19.0' );
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,11 +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
  delete_option('readygraph_upgrade_notice');
 
 
 
 
 
 
 
 
 
127
  }
128
 
129
  ?>
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.0
7
  Author: Matthew Robinson, Tanay Lakhani
8
  Author URI: http://subscribe2.wordpress.com
9
  Licence: GPL3
55
 
56
  // our version number. Don't touch this or any line below
57
  // unless you know exactly what you are doing
58
+ define( 'S2VERSION', '10.20.0' );
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
  ?>