WordPress Related Posts - Version 3.4

Version Description

  • Added support for HTTPS dashboard
  • More organized settings
  • Option to subscribe to email newsletter
  • Moved all links to plugin settings under Settings
  • Improved compatibility with Editorial Assistant
Download this release

Release Info

Developer sparkica
Plugin Icon wp plugin WordPress Related Posts
Version 3.4
Comparing to
See all releases

Code changes from version 3.3.3 to 3.4

admin_notices.php CHANGED
@@ -16,7 +16,6 @@ function wp_rp_display_admin_notices() {
16
 
17
  function wp_rp_prepare_admin_connect_notice() {
18
  $meta = wp_rp_get_meta();
19
-
20
  if ($meta['show_turn_on_button'] && !$meta['turn_on_button_pressed'] && !$meta['blog_id'] && $meta['new_user']) {
21
  wp_register_style( 'wp_rp_connect_style', plugins_url('static/css/connect.css', __FILE__) );
22
  wp_register_script( 'wp_rp_connect_js', plugins_url('static/js/connect.js', __FILE__) );
@@ -25,6 +24,9 @@ function wp_rp_prepare_admin_connect_notice() {
25
  }
26
 
27
  function wp_rp_admin_connect_notice() {
 
 
 
28
  wp_enqueue_style( 'wp_rp_connect_style' );
29
  wp_enqueue_script( 'wp_rp_connect_js' );
30
  ?>
16
 
17
  function wp_rp_prepare_admin_connect_notice() {
18
  $meta = wp_rp_get_meta();
 
19
  if ($meta['show_turn_on_button'] && !$meta['turn_on_button_pressed'] && !$meta['blog_id'] && $meta['new_user']) {
20
  wp_register_style( 'wp_rp_connect_style', plugins_url('static/css/connect.css', __FILE__) );
21
  wp_register_script( 'wp_rp_connect_js', plugins_url('static/js/connect.js', __FILE__) );
24
  }
25
 
26
  function wp_rp_admin_connect_notice() {
27
+ if (!current_user_can('delete_users')) {
28
+ return;
29
+ }
30
  wp_enqueue_style( 'wp_rp_connect_style' );
31
  wp_enqueue_script( 'wp_rp_connect_js' );
32
  ?>
config.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
 
3
- define('WP_RP_STATIC_BASE_URL', 'http://wprp.zemanta.com/static/');
4
-
5
  define('WP_RP_STATIC_THEMES_PATH', 'static/themes/');
 
 
6
 
7
  define("WP_RP_DEFAULT_CUSTOM_CSS",
8
  ".related_post_title {
@@ -43,9 +44,10 @@ define("WP_RP_RECOMMENDATIONS_NUM_PREGENERATED_POSTS", 50);
43
 
44
  define("WP_RP_THUMBNAILS_NUM_PREGENERATED_POSTS", 50);
45
 
46
- global $wp_rp_options, $wp_rp_meta;
47
  $wp_rp_options = false;
48
  $wp_rp_meta = false;
 
49
 
50
  function wp_rp_get_options() {
51
  global $wp_rp_options, $wp_rp_meta;
@@ -104,6 +106,16 @@ function wp_rp_update_options($new_options) {
104
  return $r;
105
  }
106
 
 
 
 
 
 
 
 
 
 
 
107
  function wp_rp_activate_hook() {
108
  wp_rp_get_options();
109
  wp_rp_schedule_notifications_cron();
@@ -187,6 +199,7 @@ function wp_rp_install() {
187
  'name' => '',
188
  'email' => '',
189
  'remote_notifications' => array(),
 
190
  'turn_on_button_pressed' => false,
191
  'show_statistics' => false,
192
  'show_traffic_exchange' => false,
@@ -213,17 +226,6 @@ function wp_rp_install() {
213
  'thumbnail_custom_field' => false,
214
  'display_zemanta_linky' => false,
215
  'only_admins_can_edit_related_posts' => false,
216
-
217
- 'mobile' => array(
218
- 'display_comment_count' => false,
219
- 'display_publish_date' => false,
220
- 'display_excerpt' => false,
221
- 'display_thumbnail' => false,
222
- 'excerpt_max_length' => 200,
223
- 'theme_name' => 'm-modern.css',
224
- 'theme_custom_css' => WP_RP_DEFAULT_CUSTOM_CSS,
225
- 'custom_theme_enabled' => false,
226
- ),
227
  'desktop' => array(
228
  'display_comment_count' => false,
229
  'display_publish_date' => false,
@@ -238,7 +240,7 @@ function wp_rp_install() {
238
 
239
  update_option('wp_rp_meta', $wp_rp_meta);
240
  update_option('wp_rp_options', $wp_rp_options);
241
-
242
  wp_rp_related_posts_db_table_install();
243
  }
244
 
@@ -250,6 +252,15 @@ function wp_rp_is_classic() {
250
  return false;
251
  }
252
 
 
 
 
 
 
 
 
 
 
253
  function wp_rp_migrate_3_3_2() {
254
  $wp_rp_meta = get_option('wp_rp_meta');
255
  $wp_rp_meta['version'] = '3.3.3';
1
  <?php
2
 
3
+ define('WP_RP_STATIC_BASE_URL', 'https://wprpp.s3.amazonaws.com/static/');
 
4
  define('WP_RP_STATIC_THEMES_PATH', 'static/themes/');
5
+ define('WP_RP_STATIC_JSON_PATH', 'json/');
6
+ define('WP_RP_CONTENT_BASE_URL', 'https://wprpp.s3.amazonaws.com/static/');
7
 
8
  define("WP_RP_DEFAULT_CUSTOM_CSS",
9
  ".related_post_title {
44
 
45
  define("WP_RP_THUMBNAILS_NUM_PREGENERATED_POSTS", 50);
46
 
47
+ global $wp_rp_options, $wp_rp_meta, $wp_rp_global_notice_pages;
48
  $wp_rp_options = false;
49
  $wp_rp_meta = false;
50
+ $wp_rp_global_notice_pages = array('plugins.php', 'index.php', 'update-core.php');
51
 
52
  function wp_rp_get_options() {
53
  global $wp_rp_options, $wp_rp_meta;
106
  return $r;
107
  }
108
 
109
+ function wp_rp_set_global_notice() {
110
+ $wp_rp_meta = get_option('wp_rp_meta');
111
+ $wp_rp_meta['global_notice'] = array(
112
+ 'title' => 'I\'ve installed Wordpress Related Posts plugin. Now what?',
113
+ 'message' => 'Checkout how you can <a target="_blank" href="http://zem.si/1kGo9V6">create awesome content</a>. Hint: it\'s not all about YOU ;-)'
114
+ );
115
+ update_option('wp_rp_meta', $wp_rp_meta);
116
+ }
117
+
118
+
119
  function wp_rp_activate_hook() {
120
  wp_rp_get_options();
121
  wp_rp_schedule_notifications_cron();
199
  'name' => '',
200
  'email' => '',
201
  'remote_notifications' => array(),
202
+ 'global_notice' => null,
203
  'turn_on_button_pressed' => false,
204
  'show_statistics' => false,
205
  'show_traffic_exchange' => false,
226
  'thumbnail_custom_field' => false,
227
  'display_zemanta_linky' => false,
228
  'only_admins_can_edit_related_posts' => false,
 
 
 
 
 
 
 
 
 
 
 
229
  'desktop' => array(
230
  'display_comment_count' => false,
231
  'display_publish_date' => false,
240
 
241
  update_option('wp_rp_meta', $wp_rp_meta);
242
  update_option('wp_rp_options', $wp_rp_options);
243
+ wp_rp_set_global_notice();
244
  wp_rp_related_posts_db_table_install();
245
  }
246
 
252
  return false;
253
  }
254
 
255
+ function wp_rp_migrate_3_3_3() {
256
+ $wp_rp_meta = get_option('wp_rp_meta');
257
+ $wp_rp_meta['version'] = '3.4';
258
+ $wp_rp_meta['new_user'] = false;
259
+ update_option('wp_rp_meta', $wp_rp_meta);
260
+
261
+ wp_rp_set_global_notice();
262
+ }
263
+
264
  function wp_rp_migrate_3_3_2() {
265
  $wp_rp_meta = get_option('wp_rp_meta');
266
  $wp_rp_meta['version'] = '3.3.3';
dashboard_widget.php CHANGED
@@ -15,9 +15,8 @@ function wp_rp_dashboard_setup() {
15
 
16
  if ($options['ctr_dashboard_enabled'] && $meta['blog_id'] && $meta['auth_key']) {
17
  wp_add_dashboard_widget('wp_rp_dashboard_widget', 'Related Posts', 'wp_rp_display_dashboard_widget');
18
- add_action('admin_enqueue_scripts', 'wp_rp_dashboard_scripts');
19
  }
20
- }
21
 
22
  function wp_rp_display_dashboard_widget() {
23
  $options = wp_rp_get_options();
@@ -41,6 +40,6 @@ function wp_rp_display_dashboard_widget() {
41
  function wp_rp_dashboard_scripts($hook) {
42
  if($hook === 'index.php') {
43
  wp_enqueue_script('wp_rp_dashboard_script', plugins_url('static/js/dashboard.js', __FILE__), array('jquery'));
44
- wp_enqueue_style('wp_rp_dashaboard_style', plugins_url('static/css/dashboard.css', __FILE__));
45
  }
46
  }
15
 
16
  if ($options['ctr_dashboard_enabled'] && $meta['blog_id'] && $meta['auth_key']) {
17
  wp_add_dashboard_widget('wp_rp_dashboard_widget', 'Related Posts', 'wp_rp_display_dashboard_widget');
18
+ add_action('admin_enqueue_scripts', 'wp_rp_dashboard_scripts');}
19
  }
 
20
 
21
  function wp_rp_display_dashboard_widget() {
22
  $options = wp_rp_get_options();
40
  function wp_rp_dashboard_scripts($hook) {
41
  if($hook === 'index.php') {
42
  wp_enqueue_script('wp_rp_dashboard_script', plugins_url('static/js/dashboard.js', __FILE__), array('jquery'));
43
+ //wp_enqueue_style('wp_rp_dashaboard_style', plugins_url('static/css/dashboard.css', __FILE__));
44
  }
45
  }
init.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- define('WP_RP_VERSION', '3.3.3');
3
 
4
  define('WP_RP_PLUGIN_FILE', plugin_basename(__FILE__));
5
 
@@ -13,7 +13,7 @@ include_once(dirname(__FILE__) . '/widget.php');
13
  include_once(dirname(__FILE__) . '/thumbnailer.php');
14
  include_once(dirname(__FILE__) . '/settings.php');
15
  include_once(dirname(__FILE__) . '/recommendations.php');
16
- include_once(dirname(__FILE__) . '/dashboard_widget.php');
17
  include_once(dirname(__FILE__) . '/edit_related_posts.php');
18
  include_once(dirname(__FILE__) . '/compatibility.php');
19
 
@@ -21,7 +21,6 @@ register_activation_hook(__FILE__, 'wp_rp_activate_hook');
21
  register_deactivation_hook(__FILE__, 'wp_rp_deactivate_hook');
22
 
23
  add_action('wp_head', 'wp_rp_head_resources');
24
- add_action('wp_before_admin_bar_render', 'wp_rp_extend_adminbar');
25
 
26
  add_action('plugins_loaded', 'wp_rp_init_zemanta');
27
 
@@ -33,6 +32,34 @@ function wp_rp_init_zemanta() {
33
  }
34
  }
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  function wp_rp_extend_adminbar() {
37
  global $wp_admin_bar;
38
 
@@ -87,9 +114,6 @@ function wp_rp_get_platform_options() {
87
  $thumb_options['custom_thumbnail_width'] = $options['custom_thumbnail_width'];
88
  $thumb_options['custom_thumbnail_height'] = $options['custom_thumbnail_height'];
89
  }
90
- if (wp_rp_is_phone()) {
91
- return $options['mobile'];
92
- }
93
  return $options['desktop'] + $thumb_options;
94
  }
95
 
1
  <?php
2
+ define('WP_RP_VERSION', '3.4');
3
 
4
  define('WP_RP_PLUGIN_FILE', plugin_basename(__FILE__));
5
 
13
  include_once(dirname(__FILE__) . '/thumbnailer.php');
14
  include_once(dirname(__FILE__) . '/settings.php');
15
  include_once(dirname(__FILE__) . '/recommendations.php');
16
+ //include_once(dirname(__FILE__) . '/dashboard_widget.php');
17
  include_once(dirname(__FILE__) . '/edit_related_posts.php');
18
  include_once(dirname(__FILE__) . '/compatibility.php');
19
 
21
  register_deactivation_hook(__FILE__, 'wp_rp_deactivate_hook');
22
 
23
  add_action('wp_head', 'wp_rp_head_resources');
 
24
 
25
  add_action('plugins_loaded', 'wp_rp_init_zemanta');
26
 
32
  }
33
  }
34
 
35
+
36
+ function wp_rp_get_template($file) {
37
+ return dirname(__FILE__) . "/views/$file.php";
38
+ }
39
+
40
+ function wp_rp_admin_style() {
41
+ wp_enqueue_style('wp_rp_admin_style', plugins_url('static/css/dashboard.css', __FILE__));
42
+ }
43
+ add_action( 'admin_enqueue_scripts', 'wp_rp_admin_style');
44
+
45
+ function wp_rp_global_notice() {
46
+ global $pagenow, $wp_rp_global_notice_pages;
47
+ if (!current_user_can('delete_users')) {
48
+ return;
49
+ }
50
+
51
+ $meta = wp_rp_get_meta();
52
+ $close_url = add_query_arg( array(
53
+ 'page' => 'wordpress-related-posts',
54
+ 'wprp_global_notice' => 0,
55
+ ), admin_url( 'admin.php' ));
56
+ $notice = $meta['global_notice'];
57
+ if ($notice && in_array($pagenow, $wp_rp_global_notice_pages)) {
58
+ include(wp_rp_get_template('global_notice'));
59
+ }
60
+ }
61
+ add_action('all_admin_notices', 'wp_rp_global_notice' );
62
+
63
  function wp_rp_extend_adminbar() {
64
  global $wp_admin_bar;
65
 
114
  $thumb_options['custom_thumbnail_width'] = $options['custom_thumbnail_width'];
115
  $thumb_options['custom_thumbnail_height'] = $options['custom_thumbnail_height'];
116
  }
 
 
 
117
  return $options['desktop'] + $thumb_options;
118
  }
119
 
readme.txt CHANGED
@@ -1,241 +1,256 @@
1
- === Plugin Name ===
2
- Contributors: zemanta
3
- Tags: related,posts,post,related posts,plugin
4
- License: GPLv2
5
- Requires at least: 3.3
6
- Tested up to: 3.8
7
- Stable tag: 3.3.3
8
-
9
- WordPress Related Posts generates a list of related posts with thumbnails and gives you click-through statistics.
10
-
11
- == Description ==
12
-
13
- Quickly increase your readers' engagement with your posts by adding Related Posts in the footer of your content. Automatically added Related Posts can increase your internal traffic up to 10%. Just install and activate. To attract attention and improve SEO, link out to Related Posts across the web from your compose screen. Search for posts and hand-pick them with ease. Recommendations are provided by Zemanta's world-class semantic service, including advanced analytics.
14
-
15
- The plugin also delivers statistics about Pageviews and Clicks*. It supports different styles, thumbnails and is fully customizable.
16
-
17
- After installation, go to Settings -> Related Posts in your plugins list and Turn on Advanced Features!
18
-
19
- * Real time traffic analytics are provided via third party service.
20
-
21
- == Frequently Asked Questions ==
22
-
23
- = What does this plugin do? =
24
-
25
- It places a list of links with thumbnails at the bottom of your posts. It increases pageviews and engages readers to stay on your site longer and discover more of your content. It also recommends related posts from across the web and in turn promotes your posts to other users. In this way you get new unique visitors to your site and improve SEO.
26
-
27
- = Why should I use this plugin and not any other? =
28
-
29
- WordPress Related Posts is constantly improved to bring you the highest rates of audience engagement with your content. Our highest Click-Through rates speak for themselves.
30
-
31
- = Are there any settings? Plenty! =
32
-
33
- * responsive themes
34
- * thumbnail size, style
35
- * number of posts
36
- * display post excerpt, publish date, number of comments
37
- * categories to exclude
38
- * set default image
39
-
40
- = Does it support mobile themes? =
41
-
42
- Yes, related posts are responsive so they adapt to the screen size to ensure maximum click-through rates.
43
-
44
- = Can I customize the widget? =
45
-
46
- Yes, Zemanta is offered in different themes which you can also customize with simple CSS.
47
-
48
- = Will Zemanta steal my "link-juice"? =
49
-
50
- No, Zemanta does not use redirects and is juice friendly. :)
51
-
52
- == Installation ==
53
-
54
- = Via admin: =
55
- 1. Go to Plugins -> Add New
56
- 2. Search for WordPress Related Posts
57
- 3. Install the plugin called "WordPress Related Posts" and activate it
58
- 4. After activation click Turn on to get advanced features
59
- 5. If you use any caching plugin please clear the cache
60
- 6. Done!
61
-
62
- = Via upload: =
63
- 1. Download the plugin .zip file
64
- 2. Log in to yourdomain.com/wp-admin
65
- 3. Click Plugins -> Add New -> Upload
66
- 4. After installation activate the plugin and click Turn on to get advanced features
67
- 5. If you use any caching plugin please clear the cache
68
- 6. You're finished!
69
-
70
- == Screenshots ==
71
- 1. WordPress Related Posts Default Theme.
72
- 2. WordPress Related Posts reporting real time statistics for mobile and desktop devices.
73
- 3. WordPress Related Posts responsive theme on a Galaxy Nexus and iPhone 4s.
74
-
75
- == Upgrade Notice ==
76
-
77
- = 2.7 =
78
- New thumbnailer might break backwards compatibility for blogs with custom thumbnail sizes since it resizes all thumbnails to 150x150.
79
-
80
- = 2.6.2 =
81
- Fix for security vulnerability. Upgrade immediately.
82
-
83
- == Changelog ==
84
-
85
- = 3.3.3 =
86
- * Fixed Zemanta Readside plugins incompatibility
87
- * Uninstallation added
88
- * Fixed migration bugs
89
-
90
- = 3.3.2 =
91
- * Changed default thumbnail title to image file name
92
- * Bug fixes for thumbnailer
93
- * Fixed compatibility issues with Open Graph plugins
94
-
95
- = 3.3.1 =
96
- * Added setting for admins to restrict the ability to edit automatically added Related posts to admins only
97
- * Getting ready to reorganize settings page
98
-
99
- = 3.3 =
100
- * Fixed compatibility issues with Zemanta Editorial Assistant
101
- * Fixed transparency for images on settings page
102
-
103
- = 3.2 =
104
- * Bug fixes for "Edit related posts" feature
105
- * Changed URL for static content
106
- * Added settings to fix custom size thumbnails issues (re-generating thumbnails might take a few minutes)
107
-
108
- = 3.1 =
109
- * Related content (articles) on compose screen for all users with English WordPress interface
110
- * Language detection for WordPressP interface: non-English users don't get the widget, existing ones get opt-out
111
-
112
- = 3.0 =
113
- * Opt-out for Related recommendations (articles)
114
- * Improved caching
115
-
116
- = 2.9 =
117
- * Themes are now included with the plugin to simplify loading and customization
118
- * Simplified javascript loading
119
-
120
- = 2.8 =
121
- * New thumbnailer
122
- * Edit Related Posts gets a visual upgrade, search functionality and a dose of awesome
123
- * Removed AB testing on mobile infinite stream
124
- * Bugfix in tag generator
125
-
126
- = 2.7 =
127
- * Improved thumbnailer
128
-
129
- = 2.6.3 =
130
- * Due to popular demand, "Edit related posts" is back in action. Send us more feedback to support@zemanta.com. Thanks!
131
-
132
- = 2.6.2 =
133
- * Fix for Cross-Site Request Forgery vulnerability. Credits for finding and reporting the vulnerability go to Charlie Eriksen via Secunia SVCRP.
134
-
135
- = 2.6.1 =
136
- * Fixed post excerpt bug
137
- * Link back to Zemanta is off by default
138
- * Removed "edit related posts" functionality (already edited posts won't revert back)
139
-
140
- = 2.6 =
141
- * Improved editorial control
142
- * Changed plugin content filter priority from 101 to 10
143
- * Improved AB testing on mobile infinite stream
144
- * Bugfixes
145
-
146
- = 2.5 =
147
- * Mobile themes settings
148
- * Editorial control
149
- * New Pinterest inspired theme
150
- * Support us by displaying our logo (opt-in)
151
- * Small output html layout change
152
- * Bugfixes
153
-
154
- = 2.4 =
155
- * Limit related post age
156
- * Bugfix for thumbnail extraction
157
-
158
- = 2.3 =
159
- * Earn money by displaying promoted content
160
- * Bugfixes
161
-
162
- = 2.2 =
163
- * Updated theme settings with one new theme
164
- * Option to enable related posts in article text
165
- * Support for blogging network
166
- * qTranslate support
167
- * Christmas Surprise
168
- * Bugfixes
169
- * Ho ho ho
170
-
171
- = 2.1.1 =
172
- * Exlude attachments
173
- * Use WP_Image_Editor on WP 3.5
174
-
175
- = 2.1 =
176
- * Extract thumbnails from post content
177
- * Statistics for mobile devices
178
- * Exclude pages from related posts
179
- * Bugfixes
180
-
181
- = 2.0.2 =
182
- * Fixed bug for post_types with no tags
183
-
184
- = 2.0.1 =
185
- * Fixed bug for short_open_tag=Off
186
-
187
- = 2.0 =
188
- * New recommendation engine
189
- * Statistics in dashboard
190
- * Exclude categories makes sense
191
-
192
- = 1.7 =
193
- * Improved thumbnail handling
194
- * Settings cleanup
195
- * Traffic exchange and revenue share options (beta)
196
- * Removed scroll up related posts experiment
197
-
198
- = 1.6 =
199
- * Bugfixes
200
- * Settings page update
201
- * Scroll up related posts experiment
202
-
203
- = 1.5.2 =
204
- * Opt-in remote assets
205
-
206
- = 1.5.1 =
207
- * Bugfixes
208
- * Help promote our plugin option added
209
-
210
- = 1.5 =
211
- * Pageview statistics in settings
212
- * Custom CSS
213
- * Bugfixes
214
-
215
- = 1.4 =
216
- * Improved thumbnail support
217
- * Optimized random posts generation
218
- * Drop support for WordPress 2.x
219
-
220
- = 1.3 =
221
- * Code cleanup
222
- * First two CSS themes added to Settings. More designs to come.
223
- * WordPress featured images are now used for related post thumbnails
224
- * Bugfix: Filter HTML and WP tags from post excerpts
225
-
226
- = 1.2.1 =
227
- * Sane defaults
228
-
229
- = 1.2 =
230
- * Compatible with WordPress 3.0
231
-
232
- = 1.1 =
233
- * fix don't display in Feed problem
234
-
235
- = 1.1 =
236
- * Thumbnail
237
- * Post Excerpt
238
- * Widget
239
-
240
- = 1.0 =
241
- * first version
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Plugin Name ===
2
+ Contributors: zemanta
3
+ Tags: related,posts,post,related posts,plugin,seo
4
+ License: GPLv2
5
+ Requires at least: 3.3
6
+ Tested up to: 3.9
7
+ Stable tag: 3.4
8
+
9
+ WordPress Related Posts generates a list of related posts with thumbnails and gives you click-through statistics.
10
+
11
+ == Description ==
12
+
13
+ Quickly increase your readers' engagement with your posts by adding Related Posts in the footer of your content. Automatically added Related Posts can increase your internal traffic up to 10%. Just install and activate. To attract attention and improve SEO, link out to Related Posts across the web from your compose screen. Search for posts and hand-pick them with ease. Recommendations are provided by Zemanta's world-class semantic service, including advanced analytics.
14
+ The plugin also delivers statistics about Pageviews and Clicks*. It supports different styles, thumbnails and is fully customizable.
15
+
16
+ After installation, go to Settings -> Related Posts in your plugins list and Turn on Advanced Features!
17
+
18
+
19
+ [Click here to read more about this plugin.](http://zem.si/1kc5j9Z)
20
+
21
+
22
+ **Share the Link Love**
23
+
24
+ [vimeo http://vimeo.com/91619827]
25
+
26
+ * Note: Real time traffic analytics are provided via third party service.
27
+
28
+
29
+ == Frequently Asked Questions ==
30
+
31
+ = What does this plugin do? =
32
+
33
+ It places a list of links with thumbnails at the bottom of your posts. It increases pageviews and engages readers to stay on your site longer and discover more of your content. It also recommends related posts from across the web and in turn promotes your posts to other users. In this way you get new unique visitors to your site and improve SEO.
34
+
35
+ = Why should I use this plugin and not any other? =
36
+
37
+ WordPress Related Posts is constantly improved to bring you the highest rates of audience engagement with your content. Our highest Click-Through rates speak for themselves.
38
+
39
+ = Are there any settings? Plenty! =
40
+
41
+ * responsive themes
42
+ * thumbnail size, style
43
+ * number of posts
44
+ * display post excerpt, publish date, number of comments
45
+ * categories to exclude
46
+ * set default image
47
+
48
+ = Does it support mobile themes? =
49
+
50
+ Yes, related posts are responsive so they adapt to the screen size to ensure maximum click-through rates.
51
+
52
+ = Can I customize the widget? =
53
+
54
+ Yes, Zemanta is offered in different themes which you can also customize with simple CSS.
55
+
56
+ = Will Zemanta steal my "link-juice"? =
57
+
58
+ No, Zemanta does not use redirects and is juice friendly. :)
59
+
60
+ == Installation ==
61
+
62
+ = Via admin: =
63
+ 1. Go to Plugins -> Add New
64
+ 2. Search for WordPress Related Posts
65
+ 3. Install the plugin called "WordPress Related Posts" and activate it
66
+ 4. After activation click Turn on to get advanced features
67
+ 5. If you use any caching plugin please clear the cache
68
+ 6. Done!
69
+
70
+ = Via upload: =
71
+ 1. Download the plugin .zip file
72
+ 2. Log in to yourdomain.com/wp-admin
73
+ 3. Click Plugins -> Add New -> Upload
74
+ 4. After installation activate the plugin and click Turn on to get advanced features
75
+ 5. If you use any caching plugin please clear the cache
76
+ 6. You're finished!
77
+
78
+ == Screenshots ==
79
+ 1. WordPress Related Posts Default Theme.
80
+ 2. WordPress Related Posts reporting real time statistics for mobile and desktop devices.
81
+ 3. WordPress Related Posts responsive theme on a Galaxy Nexus and iPhone 4s.
82
+
83
+ == Upgrade Notice ==
84
+
85
+ = 2.7 =
86
+ New thumbnailer might break backwards compatibility for blogs with custom thumbnail sizes since it resizes all thumbnails to 150x150.
87
+
88
+ = 2.6.2 =
89
+ Fix for security vulnerability. Upgrade immediately.
90
+
91
+ == Changelog ==
92
+
93
+ = 3.4 =
94
+ * Added support for HTTPS dashboard
95
+ * More organized settings
96
+ * Option to subscribe to email newsletter
97
+ * Moved all links to plugin settings under Settings
98
+ * Improved compatibility with Editorial Assistant
99
+
100
+ = 3.3.3 =
101
+ * Fixed Zemanta Readside plugins incompatibility
102
+ * Uninstallation added
103
+ * Fixed migration bugs
104
+
105
+ = 3.3.2 =
106
+ * Changed default thumbnail title to image file name
107
+ * Bug fixes for thumbnailer
108
+ * Fixed compatibility issues with Open Graph plugins
109
+
110
+ = 3.3.1 =
111
+ * Added setting for admins to restrict the ability to edit automatically added Related posts to admins only
112
+ * Getting ready to reorganize settings page
113
+
114
+ = 3.3 =
115
+ * Fixed compatibility issues with Zemanta Editorial Assistant
116
+ * Fixed transparency for images on settings page
117
+
118
+ = 3.2 =
119
+ * Bug fixes for "Edit related posts" feature
120
+ * Changed URL for static content
121
+ * Added settings to fix custom size thumbnails issues (re-generating thumbnails might take a few minutes)
122
+
123
+ = 3.1 =
124
+ * Related content (articles) on compose screen for all users with English WordPress interface
125
+ * Language detection for WordPressP interface: non-English users don't get the widget, existing ones get opt-out
126
+
127
+ = 3.0 =
128
+ * Opt-out for Related recommendations (articles)
129
+ * Improved caching
130
+
131
+ = 2.9 =
132
+ * Themes are now included with the plugin to simplify loading and customization
133
+ * Simplified javascript loading
134
+
135
+ = 2.8 =
136
+ * New thumbnailer
137
+ * Edit Related Posts gets a visual upgrade, search functionality and a dose of awesome
138
+ * Removed AB testing on mobile infinite stream
139
+ * Bugfix in tag generator
140
+
141
+ = 2.7 =
142
+ * Improved thumbnailer
143
+
144
+ = 2.6.3 =
145
+ * Due to popular demand, "Edit related posts" is back in action. Send us more feedback to support@zemanta.com. Thanks!
146
+
147
+ = 2.6.2 =
148
+ * Fix for Cross-Site Request Forgery vulnerability. Credits for finding and reporting the vulnerability go to Charlie Eriksen via Secunia SVCRP.
149
+
150
+ = 2.6.1 =
151
+ * Fixed post excerpt bug
152
+ * Link back to Zemanta is off by default
153
+ * Removed "edit related posts" functionality (already edited posts won't revert back)
154
+
155
+ = 2.6 =
156
+ * Improved editorial control
157
+ * Changed plugin content filter priority from 101 to 10
158
+ * Improved AB testing on mobile infinite stream
159
+ * Bugfixes
160
+
161
+ = 2.5 =
162
+ * Mobile themes settings
163
+ * Editorial control
164
+ * New Pinterest inspired theme
165
+ * Support us by displaying our logo (opt-in)
166
+ * Small output html layout change
167
+ * Bugfixes
168
+
169
+ = 2.4 =
170
+ * Limit related post age
171
+ * Bugfix for thumbnail extraction
172
+
173
+ = 2.3 =
174
+ * Earn money by displaying promoted content
175
+ * Bugfixes
176
+
177
+ = 2.2 =
178
+ * Updated theme settings with one new theme
179
+ * Option to enable related posts in article text
180
+ * Support for blogging network
181
+ * qTranslate support
182
+ * Christmas Surprise
183
+ * Bugfixes
184
+ * Ho ho ho
185
+
186
+ = 2.1.1 =
187
+ * Exlude attachments
188
+ * Use WP_Image_Editor on WP 3.5
189
+
190
+ = 2.1 =
191
+ * Extract thumbnails from post content
192
+ * Statistics for mobile devices
193
+ * Exclude pages from related posts
194
+ * Bugfixes
195
+
196
+ = 2.0.2 =
197
+ * Fixed bug for post_types with no tags
198
+
199
+ = 2.0.1 =
200
+ * Fixed bug for short_open_tag=Off
201
+
202
+ = 2.0 =
203
+ * New recommendation engine
204
+ * Statistics in dashboard
205
+ * Exclude categories makes sense
206
+
207
+ = 1.7 =
208
+ * Improved thumbnail handling
209
+ * Settings cleanup
210
+ * Traffic exchange and revenue share options (beta)
211
+ * Removed scroll up related posts experiment
212
+
213
+ = 1.6 =
214
+ * Bugfixes
215
+ * Settings page update
216
+ * Scroll up related posts experiment
217
+
218
+ = 1.5.2 =
219
+ * Opt-in remote assets
220
+
221
+ = 1.5.1 =
222
+ * Bugfixes
223
+ * Help promote our plugin option added
224
+
225
+ = 1.5 =
226
+ * Pageview statistics in settings
227
+ * Custom CSS
228
+ * Bugfixes
229
+
230
+ = 1.4 =
231
+ * Improved thumbnail support
232
+ * Optimized random posts generation
233
+ * Drop support for WordPress 2.x
234
+
235
+ = 1.3 =
236
+ * Code cleanup
237
+ * First two CSS themes added to Settings. More designs to come.
238
+ * WordPress featured images are now used for related post thumbnails
239
+ * Bugfix: Filter HTML and WP tags from post excerpts
240
+
241
+ = 1.2.1 =
242
+ * Sane defaults
243
+
244
+ = 1.2 =
245
+ * Compatible with WordPress 3.0
246
+
247
+ = 1.1 =
248
+ * fix don't display in Feed problem
249
+
250
+ = 1.1 =
251
+ * Thumbnail
252
+ * Post Excerpt
253
+ * Widget
254
+
255
+ = 1.0 =
256
+ * first version
settings.php CHANGED
@@ -7,19 +7,7 @@ add_action('admin_head', 'wp_rp_admin_head');
7
  function wp_rp_admin_head() {
8
  $menu_icon = plugins_url('static/img/menu_icon.png', __FILE__);
9
  $menu_icon_retina = plugins_url('static/img/menu_icon_2x.png', __FILE__);
10
- ?>
11
- <style type="text/css">
12
- #toplevel_page_wordpress-related-posts .wp-menu-image {
13
- background: url('<?php echo $menu_icon; ?>') 7px 6px no-repeat;
14
- }
15
- @media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
16
- #toplevel_page_wordpress-related-posts .wp-menu-image {
17
- background-image: url('<?php echo $menu_icon_retina; ?>');
18
- background-size: 16px 16px;
19
- }
20
- }
21
- </style>
22
- <?php
23
  }
24
 
25
  /**
@@ -32,6 +20,52 @@ function wp_rp_add_link_to_settings($links) {
32
  }
33
  add_filter('plugin_action_links_' . WP_RP_PLUGIN_FILE, 'wp_rp_add_link_to_settings', 10, 2);
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  /**
36
  * Settings
37
  **/
@@ -43,17 +77,15 @@ function wp_rp_settings_admin_menu() {
43
  return;
44
  }
45
 
46
- $title = __('Related Posts', 'wp_related_posts');
47
  $count = wp_rp_number_of_available_notifications();
48
 
49
  if($count) {
50
  $title .= ' <span class="update-plugins count-' . $count . '"><span class="plugin-count">' . $count . '</span></span>';
51
  }
52
 
53
- $page = add_menu_page(__('Related Posts', 'wp_related_posts'), $title,
54
- 'manage_options', 'wordpress-related-posts', 'wp_rp_settings_page', 'div');
55
-
56
- add_action('admin_print_styles-' . $page, 'wp_rp_settings_styles');
57
  add_action('admin_print_scripts-' . $page, 'wp_rp_settings_scripts');
58
  }
59
 
@@ -141,6 +173,11 @@ function wp_rp_settings_page() {
141
  $options = wp_rp_get_options();
142
  $meta = wp_rp_get_meta();
143
 
 
 
 
 
 
144
  $postdata = stripslashes_deep($_POST);
145
 
146
  // load notifications every time user goes to settings page
@@ -172,14 +209,6 @@ function wp_rp_settings_page() {
172
  'display_zemanta_linky' => $meta['show_zemanta_linky_option'] ? isset($postdata['wp_rp_display_zemanta_linky']) : true,
173
  'only_admins_can_edit_related_posts' => !empty($postdata['wp_rp_only_admins_can_edit_related_posts']),
174
 
175
- 'mobile' => array(
176
- 'display_comment_count' => isset($postdata['wp_rp_mobile_display_comment_count']),
177
- 'display_publish_date' => isset($postdata['wp_rp_mobile_display_publish_date']),
178
- 'display_excerpt' => isset($postdata['wp_rp_mobile_display_excerpt']),
179
- 'display_thumbnail' => isset($postdata['wp_rp_mobile_display_thumbnail']),
180
- 'excerpt_max_length' => (isset($postdata['wp_rp_mobile_excerpt_max_length']) && is_numeric(trim($postdata['wp_rp_mobile_excerpt_max_length']))) ? intval(trim($postdata['wp_rp_mobile_excerpt_max_length'])) : 200,
181
- 'custom_theme_enabled' => isset($postdata['wp_rp_mobile_custom_theme_enabled']),
182
- ),
183
  'desktop' => array(
184
  'display_comment_count' => isset($postdata['wp_rp_desktop_display_comment_count']),
185
  'display_publish_date' => isset($postdata['wp_rp_desktop_display_publish_date']),
@@ -198,13 +227,13 @@ function wp_rp_settings_page() {
198
  $new_options['exclude_categories'] = trim($postdata['wp_rp_exclude_categories']);
199
  }
200
 
201
- foreach(array('mobile', 'desktop') as $platform) {
202
  if(isset($postdata['wp_rp_' . $platform . '_theme_name'])) { // If this isn't set, maybe the AJAX didn't load...
203
  $new_options[$platform]['theme_name'] = trim($postdata['wp_rp_' . $platform . '_theme_name']);
204
-
205
  if(isset($postdata['wp_rp_' . $platform . '_theme_custom_css'])) {
206
  $new_options[$platform]['theme_custom_css'] = $postdata['wp_rp_' . $platform . '_theme_custom_css'];
207
- } else {
208
  $new_options[$platform]['theme_custom_css'] = '';
209
  }
210
  } else {
@@ -223,11 +252,10 @@ function wp_rp_settings_page() {
223
  if (isset($postdata['wp_rp_turn_on_button_pressed'])) {
224
  $meta['show_turn_on_button'] = false;
225
  $meta['turn_on_button_pressed'] = $postdata['wp_rp_turn_on_button_pressed'];
226
- $new_options['mobile']['display_thumbnail'] = true;
227
  $new_options['desktop']['display_thumbnail'] = true;
228
  }
229
 
230
- $preprocess_thumbnails = ($new_options['desktop']['display_thumbnail'] && !$old_options['desktop']['display_thumbnail']) || ($new_options['mobile']['display_thumbnail'] && !$old_options['mobile']['display_thumbnail']);
231
 
232
 
233
  $default_thumbnail_path = wp_rp_upload_default_thumbnail_file();
@@ -249,7 +277,7 @@ function wp_rp_settings_page() {
249
  if($new_options['ctr_dashboard_enabled'] && !$old_options['ctr_dashboard_enabled']) {
250
  $meta['show_statistics'] = true;
251
 
252
- if($new_options['desktop']['display_thumbnail'] || $new_options['mobile']['display_thumbnail']) {
253
  $meta['show_turn_on_button'] = false;
254
  }
255
 
@@ -276,338 +304,39 @@ function wp_rp_settings_page() {
276
  wp_rp_register_blog($button_type);
277
  }
278
 
279
- ?>
280
-
281
- <div class="wrap" id="wp_rp_wrap">
282
- <input type="hidden" id="wp_rp_ajax_nonce" value="<?php echo wp_create_nonce("wp_rp_ajax_nonce"); ?>" />
283
-
284
- <input type="hidden" id="wp_rp_version" value="<?php esc_attr_e(WP_RP_VERSION); ?>" />
285
- <input type="hidden" id="wp_rp_dashboard_url" value="<?php esc_attr_e(WP_RP_CTR_DASHBOARD_URL); ?>" />
286
- <input type="hidden" id="wp_rp_static_base_url" value="<?php esc_attr_e(WP_RP_STATIC_BASE_URL); ?>" />
287
- <input type="hidden" id="wp_rp_plugin_static_base_url" value="<?php esc_attr_e(plugins_url("static/", __FILE__)); ?>" />
288
-
289
- <?php if ($options['ctr_dashboard_enabled']):?>
290
- <input type="hidden" id="wp_rp_blog_id" value="<?php esc_attr_e($meta['blog_id']); ?>" />
291
- <input type="hidden" id="wp_rp_auth_key" value="<?php esc_attr_e($meta['auth_key']); ?>" />
292
- <?php endif; ?>
293
-
294
- <?php if($meta['show_traffic_exchange'] && $options['traffic_exchange_enabled']): ?>
295
- <input type="hidden" id="wp_rp_show_traffic_exchange_statistics" value="1" />
296
- <?php endif; ?>
297
- <?php if($meta['remote_recommendations'] && $options['promoted_content_enabled']): ?>
298
- <input type="hidden" id="wp_rp_show_promoted_content_statistics" value="1" />
299
- <?php endif; ?>
300
-
301
- <div class="header">
302
- <div class="support">
303
- <h4><?php _e("Awesome support", 'wp_related_posts'); ?></h4>
304
- <p>
305
- <?php _e("If you have any questions please contact us at",'wp_related_posts');?> <a target="_blank" href="mailto:support+wprp@zemanta.com"><?php _e("support", 'wp_related_posts');?></a>.
306
- </p>
307
- </div>
308
- <h2 class="title"><?php _e("Related Posts by ",'wp_related_posts');?><a href="http://www.zemanta.com">Zemanta</a></h2>
309
- </div>
310
-
311
- <?php wp_rp_print_notifications(); ?>
312
-
313
- <?php if($meta['show_turn_on_button']): ?>
314
- <div id="wp_rp_turn_on_statistics">
315
- <div class="turn_on_wrap">
316
- <h4>Turn on Related Posts and start using awesome features.</h4>
317
- <div class="button_wrap">
318
- <a data-type="singlebutton" href="#" class="zemanta-button turn-on">Turn on Related Posts</a>
319
- </div>
320
- <p>By turning on Related Posts you agree to <a href="http://www.zemanta.com/rp-tos" target="_blank">terms of service.</a></p>
321
- <p>You'll get Advanced Settings, Themes, Thumbnails and Analytics Dashboard. These features are provided by <a target="_blank" href="http://www.zemanta.com">Zemanta</a> as a service.</p>
322
- </div>
323
- <img class="screendesc" src="<?php echo plugins_url("static/img/turnonscreen.jpg", __FILE__); ?>" />
324
- </div>
325
- <?php endif; ?>
326
-
327
- <form method="post" enctype="multipart/form-data" action="<?php echo admin_url('admin.php?page=wordpress-related-posts'); ?>" id="wp_rp_settings_form" style="display: <?php echo ($meta['show_turn_on_button'] && !$meta['turn_on_button_pressed'] && !$meta['blog_id'] ? 'none' : 'block'); ?>;">
328
- <?php wp_nonce_field('wp_rp_settings', '_wp_rp_nonce') ?>
329
-
330
- <?php if ($options['ctr_dashboard_enabled']): ?>
331
- <div id="wp_rp_earnings_holder" style="display:none;">
332
- <h2><?php _e('Earnings', 'wp_related_posts'); ?></h2>
333
- <div class="container">
334
- <p>By displaying promoted posts on your site you've already earned:</p>
335
- <div id="wp_rp_earnings_wrap">
336
- <span class="num"></span>
337
- <a href="#" class="claim disabled">claim
338
- <span class="payout-explain">You can claim the money when it reaches <span class="payout"></span>.</span>
339
- </a>
340
- </div>
341
- </div>
342
- </div>
343
- <div id="wp_rp_statistics_holder">
344
- <div id="wp_rp_statistics_collapsible" block="statistics" class="collapsible<?php if(!$meta['show_statistics']) { echo " collapsed"; } ?>">
345
- <a href="#" class="collapse-handle">Collapse</a>
346
- <h2><?php _e('Statistics', 'wp_related_posts'); ?></h2>
347
- <div class="container" <?php if(!$meta['show_statistics']) { echo ' style="display: none;" '; } ?>>
348
- <div id="wp_rp_statistics_wrap">
349
- <div class="message unavailable"><?php _e("Statistics currently unavailable",'wp_related_posts'); ?></div>
350
- </div>
351
- </div>
352
- </div>
353
- </div>
354
- <?php endif; ?>
355
-
356
- <div>
357
- <h2><?php _e("Settings",'wp_related_posts');?></h2>
358
-
359
- <?php do_action('wp_rp_admin_notices'); ?>
360
-
361
- <div class="container">
362
- <h3><?php _e("Basic Settings",'wp_related_posts');?></h3>
363
-
364
- <table class="form-table">
365
- <tr valign="top">
366
- <th scope="row"><?php _e('Related Posts Title:', 'wp_related_posts'); ?></th>
367
- <td>
368
- <input name="wp_rp_related_posts_title" type="text" id="wp_rp_related_posts_title" value="<?php esc_attr_e($options['related_posts_title']); ?>" class="regular-text" />
369
- </td>
370
- </tr>
371
- <tr valign="top">
372
- <th scope="row"><?php _e('Number of Posts:', 'wp_related_posts');?></th>
373
- <td>
374
- <input name="wp_rp_max_related_posts" type="number" step="1" id="wp_rp_max_related_posts" class="small-text" min="1" value="<?php esc_attr_e($options['max_related_posts']); ?>" />
375
- </td>
376
- </tr>
377
- <tr valign="top">
378
- <th scope="row"></th>
379
- <td><label>
380
- <?php _e('Only show posts from the last', 'wp_related_posts');?>&nbsp;
381
- <select name="wp_rp_max_related_post_age_in_days" id="wp_rp_max_related_post_age_in_days">
382
- <option value="0" <?php selected($options['max_related_post_age_in_days'], 0); ?>>Unlimited</option>
383
- <option value="30" <?php selected($options['max_related_post_age_in_days'], 30); ?>>1</option>
384
- <option value="91" <?php selected($options['max_related_post_age_in_days'], 91); ?>>3</option>
385
- <option value="365" <?php selected($options['max_related_post_age_in_days'], 365); ?>>12</option>
386
- </select> &nbsp;months.
387
- </label></td>
388
- </tr>
389
- </table><?php
390
-
391
- /**************************************
392
- * Theme Settings *
393
- **************************************/
394
-
395
- ?>
396
- <h3>Theme Settings</h3>
397
- <label>
398
- <input name="wp_rp_enable_themes" type="checkbox" id="wp_rp_enable_themes" value="yes"<?php checked($options["enable_themes"]); ?> />
399
- <?php _e("Enable Themes",'wp_related_posts'); ?>*
400
- </label>
401
-
402
- <div id="wp_rp_theme_options_wrap" style="display:none;">
403
- <?php foreach(array('desktop' => 'Desktop/Tablet', 'mobile' => 'Mobile Phones') as $platform => $platform_title): ?>
404
- <input type="hidden" id="wp_rp_<?php echo $platform; ?>_theme_selected" value="<?php esc_attr_e($options[$platform]['theme_name']); ?>" />
405
- <table class="form-table wp_rp_settings_table">
406
- <tr id="wp_rp_<?php echo $platform; ?>_theme_options_wrap">
407
- <td>
408
- <h4><?php _e($platform_title, 'wp_related_posts'); ?></h4>
409
- <div id="wp_rp_<?php echo $platform; ?>_theme_area" style="display: none;">
410
- <div class="theme-list"></div>
411
- <div class="theme-screenshot"></div>
412
- <div class="theme-extra-options">
413
- <label class="wp_rp_settings_button">
414
- <input type="checkbox" id="wp_rp_<?php echo $platform; ?>_custom_theme_enabled" name="wp_rp_<?php echo $platform; ?>_custom_theme_enabled" value="yes" <?php checked($options[$platform]['custom_theme_enabled']); ?> />
415
- Customize
416
- </label>
417
- </div>
418
- </div>
419
- </td>
420
- </tr>
421
- <tr id="wp_rp_<?php echo $platform; ?>_theme_custom_css_wrap" style="display: none; ">
422
- <td>
423
- <label>
424
- <input name="wp_rp_<?php echo $platform; ?>_display_thumbnail" type="checkbox" id="wp_rp_<?php echo $platform; ?>_display_thumbnail" value="yes" <?php checked($options[$platform]["display_thumbnail"]); ?> />
425
- <?php _e("Display Thumbnails For Related Posts",'wp_related_posts');?>
426
- </label><br />
427
- <label>
428
- <input name="wp_rp_<?php echo $platform; ?>_display_comment_count" type="checkbox" id="wp_rp_<?php echo $platform; ?>_display_comment_count" value="yes" <?php checked($options[$platform]["display_comment_count"]); ?>>
429
- <?php _e("Display Number of Comments",'wp_related_posts');?>
430
- </label><br />
431
- <label>
432
- <input name="wp_rp_<?php echo $platform; ?>_display_publish_date" type="checkbox" id="wp_rp_<?php echo $platform; ?>_display_publish_date" value="yes" <?php checked($options[$platform]["display_publish_date"]); ?>>
433
- <?php _e("Display Publish Date",'wp_related_posts');?>
434
- </label><br />
435
- <label>
436
- <input name="wp_rp_<?php echo $platform; ?>_display_excerpt" type="checkbox" id="wp_rp_<?php echo $platform; ?>_display_excerpt" value="yes" <?php checked($options[$platform]["display_excerpt"]); ?> />
437
- <?php _e("Display Post Excerpt",'wp_related_posts');?>
438
- </label>
439
- <label id="wp_rp_<?php echo $platform; ?>_excerpt_max_length_label">
440
- <input name="wp_rp_<?php echo $platform; ?>_excerpt_max_length" type="text" id="wp_rp_<?php echo $platform; ?>_excerpt_max_length" class="small-text" value="<?php esc_attr_e($options[$platform]["excerpt_max_length"]); ?>" /> <span class="description"><?php _e('Maximum Number of Characters.', 'wp_related_posts'); ?></span>
441
- </label>
442
- <br/>
443
- <h4>Custom CSS</h4>
444
- <textarea style="width: 300px; height: 215px; background: #EEE;" name="wp_rp_<?php echo $platform; ?>_theme_custom_css" class="custom-css"><?php echo htmlspecialchars($options[$platform]['theme_custom_css'], ENT_QUOTES); ?></textarea>
445
- </td>
446
- </tr>
447
- <tr>
448
- <td>
449
-
450
- </td>
451
- </tr>
452
- </table>
453
- <?php endforeach; ?>
454
- </div><?php
455
-
456
- /**************************************
457
- * Thumbnail Settings *
458
- **************************************/
459
-
460
- ?>
461
- <table class="form-table">
462
- <tbody>
463
- <tr valign="top">
464
- <td>
465
- <label>
466
- <?php _e('For posts without images, a default image will be shown.<br/>
467
- You can upload your own default image here','wp_related_posts');?>
468
- <input type="file" name="wp_rp_default_thumbnail" />
469
- </label>
470
- <?php if($options['default_thumbnail_path']) : ?>
471
- <span style="display: inline-block; vertical-align: top; *display: inline; zoom: 1;">
472
- <img style="padding: 3px; border: 1px solid #DFDFDF; border-radius: 3px;" valign="top" width="80" height="80" src="<?php esc_attr_e(wp_rp_get_default_thumbnail_url()); ?>" alt="selected thumbnail" />
473
- <br />
474
- <label>
475
- <input type="checkbox" name="wp_rp_default_thumbnail_remove" value="yes" />
476
- <?php _e("Remove selected",'wp_related_posts');?>
477
- </label>
478
- </span>
479
- <?php endif; ?>
480
-
481
- <?php
482
- global $wpdb;
483
-
484
- $custom_fields = $wpdb->get_col( "SELECT meta_key FROM $wpdb->postmeta GROUP BY meta_key HAVING meta_key NOT LIKE '\_%' ORDER BY LOWER(meta_key)" );
485
- if($custom_fields) :
486
- ?>
487
- <br />
488
- <br />
489
- <label><input name="wp_rp_thumbnail_use_custom" type="checkbox" value="yes" <?php checked($options['thumbnail_use_custom']); ?>> Use custom field for thumbnails</label>
490
- <select name="wp_rp_thumbnail_custom_field" id="wp_rp_thumbnail_custom_field" class="postform">
491
-
492
- <?php foreach ( $custom_fields as $custom_field ) : ?>
493
- <option value="<?php esc_attr_e($custom_field); ?>"<?php selected($options["thumbnail_custom_field"], $custom_field); ?>><?php esc_html_e($custom_field);?></option>
494
- <?php endforeach; ?>
495
- </select>
496
- <br />
497
- <?php endif; ?>
498
- </td>
499
- </tr>
500
- </tbody>
501
- </table>
502
- <h3>Custom Size Thumbnails</h3>
503
- <table class="form-table">
504
- <tbody>
505
- <tr><td>
506
- Our themes were created with thumbnail size of 150x150px in mind.<br>
507
- If you want to use custom sizes, override theme's CSS rules in the Custom CSS section under Theme Settings above.
508
- </td></tr>
509
- <tr><td>
510
- <label>
511
- <input name="wp_rp_custom_size_thumbnail_enabled" type="checkbox" id="wp_rp_custom_size_thumbnail_enabled" value="yes" <?php checked($options['custom_size_thumbnail_enabled']); ?> />
512
- <?php _e("Use Custom Size Thumbnails",'wp_related_posts');?>
513
- </label><br />
514
- <div id="wp_rp_custom_thumb_sizes_settings" style="display:none">
515
- <label>
516
- <?php _e("Custom Width (px)",'wp_related_posts');?>
517
- <input name="wp_rp_custom_thumbnail_width" type="text" id="wp_rp_custom_thumbnail_width" class="small-text" value="<?php esc_attr_e($options['custom_thumbnail_width']); ?>" />
518
- </label>
519
- <label>
520
- <?php _e("Custom Height (px)",'wp_related_posts');?>
521
- <input name="wp_rp_custom_thumbnail_height" type="text" id="wp_rp_custom_thumbnail_height" class="small-text" value="<?php esc_attr_e($options['custom_thumbnail_height']); ?>" />
522
- </label>
523
- </div>
524
- </td></tr>
525
- </tbody>
526
- </table><?php
527
-
528
- /**************************************
529
- * Other Settings *
530
- **************************************/
531
-
532
- ?>
533
- <h3><?php _e("Other Settings:",'wp_related_posts'); ?></h3>
534
- <table class="form-table">
535
- <tr valign="top">
536
- <th scope="row"><?php _e('Exclude these Categories:', 'wp_related_posts'); ?></th>
537
- <td>
538
- <div class="excluded-categories">
539
- <?php
540
- $exclude = explode(',', $options['exclude_categories']);
541
- $args = array(
542
- 'orderby' => 'name',
543
- 'order' => 'ASC',
544
- 'hide_empty' => false
545
- );
546
-
547
- foreach (get_categories($args) as $category) :
548
- ?>
549
- <label>
550
- <input name="wp_rp_exclude_categories[]" type="checkbox" id="wp_rp_exclude_categories" value="<?php esc_attr_e($category->cat_ID); ?>"<?php checked(in_array($category->cat_ID, $exclude)); ?> />
551
- <?php esc_html_e($category->cat_name); ?>
552
- <br />
553
- </label>
554
- <?php endforeach; ?>
555
- </div>
556
- </td>
557
- </tr>
558
- <tr valign="top">
559
- <td colspan="2"><?php if(strpos(get_bloginfo('language'), 'en') === 0 || $meta['classic_user']): ?>
560
- <br/>
561
- <label>
562
- <input name="wp_rp_classic_state" type="checkbox" id="wp_rp_classic_state" value="yes" <?php checked($meta['classic_user']); ?>>
563
- <?php _e("Display Related Posts Recommendations on Compose Screen",'wp_related_posts');?>
564
- </label><?php endif; ?>
565
- <br/>
566
- <label>
567
- <input name="wp_rp_on_single_post" type="checkbox" id="wp_rp_on_single_post" value="yes" <?php checked($options['on_single_post']); ?>>
568
- <?php _e("Auto Insert Related Posts",'wp_related_posts');?>
569
- </label>
570
- (or add <pre style="display: inline">&lt;?php wp_related_posts()?&gt;</pre> to your single post template)
571
- <br />
572
- <label>
573
- <input name="wp_rp_on_rss" type="checkbox" id="wp_rp_on_rss" value="yes"<?php checked($options['on_rss']); ?>>
574
- <?php _e("Display Related Posts in Feed",'wp_related_posts');?>
575
- </label>
576
- <br />
577
- <label>
578
- <input name="wp_rp_ctr_dashboard_enabled" type="checkbox" id="wp_rp_ctr_dashboard_enabled" value="yes" <?php checked($options['ctr_dashboard_enabled']); ?> />
579
- <?php _e("Turn statistics on",'wp_related_posts');?>*
580
- </label>
581
- <br />
582
- <div style="display:<?php echo $meta['show_traffic_exchange'] ? 'block' : 'none' ?>;">
583
- <label>
584
- <input name="wp_rp_traffic_exchange_enabled" type="checkbox" id="wp_rp_traffic_exchange_enabled" value="yes"<?php checked($options['traffic_exchange_enabled']); ?>>
585
- <?php _e("Enable traffic exchange with blogger networks",'wp_related_posts');?>
586
- </label>
587
- </div>
588
- <div style="display:<?php echo $meta['remote_recommendations'] ? 'block' : 'none' ?>;">
589
- <label>
590
- <input name="wp_rp_promoted_content_enabled" type="checkbox" id="wp_rp_promoted_content_enabled" value="yes" <?php checked($options['promoted_content_enabled']); ?> />
591
- <?php _e('Promoted Content', 'wp_related_posts');?>*
592
- </label>
593
- </div><?php if($meta['show_zemanta_linky_option']): ?>
594
- <label>
595
- <input name="wp_rp_display_zemanta_linky" type="checkbox" id="wp_rp_display_zemanta_linky" value="yes" <?php checked($options['display_zemanta_linky']); ?> />
596
- <?php _e("Support us (show our logo)",'wp_related_posts');?>
597
- </label><?php endif; ?>
598
- <div>
599
- <label>
600
- <input type="checkbox" name="wp_rp_only_admins_can_edit_related_posts" id="wp_rp_only_admins_can_edit_related_posts" value="yes" <?php checked($options['only_admins_can_edit_related_posts']); ?> />
601
- <?php _e("Only admins can edit Related Posts",'wp_related_posts');?>
602
- </label>
603
- </div>
604
- </td>
605
- </tr>
606
- </table>
607
- <p class="submit"><input type="submit" value="<?php _e('Save changes', 'wp_related_posts'); ?>" class="button-primary" /></p>
608
-
609
- </div>
610
- </div>
611
- </form>
612
- </div>
613
- <?php } ?>
7
  function wp_rp_admin_head() {
8
  $menu_icon = plugins_url('static/img/menu_icon.png', __FILE__);
9
  $menu_icon_retina = plugins_url('static/img/menu_icon_2x.png', __FILE__);
10
+ include wp_rp_get_template('admin_head');
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
12
 
13
  /**
20
  }
21
  add_filter('plugin_action_links_' . WP_RP_PLUGIN_FILE, 'wp_rp_add_link_to_settings', 10, 2);
22
 
23
+ function wp_rp_subscription($email_or_unsubscribe) {
24
+ $meta = wp_rp_get_meta();
25
+ if(! $meta['blog_id']) return false;
26
+ $blob = ($email_or_unsubscribe ? $email_or_unsubscribe : 'email');
27
+ $post = array(
28
+ 'blog_id' => $meta['blog_id'],
29
+ 'secret' => hash_hmac('sha256', $blob, $meta['auth_key']),
30
+ );
31
+ if ($email_or_unsubscribe) {
32
+ $post['email'] = $email_or_unsubscribe;
33
+ }
34
+ $response = wp_remote_post(WP_RP_CTR_DASHBOARD_URL . 'subscribe/', array(
35
+ 'body' => $post,
36
+ 'timeout' => 30
37
+ ));
38
+ if (wp_remote_retrieve_response_code($response) == 200) {
39
+ $body = wp_remote_retrieve_body($response);
40
+ if ($body) {
41
+ $response_json = json_decode($body);
42
+ if ($response_json->status !== 'ok') return false;
43
+
44
+ $meta['subscribed'] = (int) !!$email_or_unsubscribe;
45
+ $meta['email'] = $email_or_unsubscribe;
46
+ wp_rp_update_meta($meta);
47
+ }
48
+ return true;
49
+ }
50
+ return false;
51
+ }
52
+
53
+ function wp_rp_ajax_subscribe_callback () {
54
+ check_ajax_referer('wp_rp_ajax_nonce');
55
+
56
+ $email = (!empty($_POST['email']) && $_POST['email'] !== '0') ? $_POST['email'] : false;
57
+ if (wp_rp_subscription($email)) {
58
+ print "1";
59
+ }
60
+ else {
61
+ print "0";
62
+ }
63
+ die();
64
+ }
65
+
66
+ add_action('wp_ajax_wprp_subscribe', 'wp_rp_ajax_subscribe_callback');
67
+
68
+
69
  /**
70
  * Settings
71
  **/
77
  return;
78
  }
79
 
80
+ $title = __('Wordpress Related Posts', 'wp_related_posts');
81
  $count = wp_rp_number_of_available_notifications();
82
 
83
  if($count) {
84
  $title .= ' <span class="update-plugins count-' . $count . '"><span class="plugin-count">' . $count . '</span></span>';
85
  }
86
 
87
+ $page = add_options_page(__('Wordpress Related Posts', 'wp_related_posts'), $title,
88
+ 'manage_options', 'wordpress-related-posts', 'wp_rp_settings_page');
 
 
89
  add_action('admin_print_scripts-' . $page, 'wp_rp_settings_scripts');
90
  }
91
 
173
  $options = wp_rp_get_options();
174
  $meta = wp_rp_get_meta();
175
 
176
+ if ( isset( $_GET['wprp_global_notice'] ) && $_GET['wprp_global_notice'] === '0') {
177
+ $meta['global_notice'] = null;
178
+ wp_rp_update_meta($meta);
179
+ }
180
+
181
  $postdata = stripslashes_deep($_POST);
182
 
183
  // load notifications every time user goes to settings page
209
  'display_zemanta_linky' => $meta['show_zemanta_linky_option'] ? isset($postdata['wp_rp_display_zemanta_linky']) : true,
210
  'only_admins_can_edit_related_posts' => !empty($postdata['wp_rp_only_admins_can_edit_related_posts']),
211
 
 
 
 
 
 
 
 
 
212
  'desktop' => array(
213
  'display_comment_count' => isset($postdata['wp_rp_desktop_display_comment_count']),
214
  'display_publish_date' => isset($postdata['wp_rp_desktop_display_publish_date']),
227
  $new_options['exclude_categories'] = trim($postdata['wp_rp_exclude_categories']);
228
  }
229
 
230
+ foreach(array('desktop') as $platform) {
231
  if(isset($postdata['wp_rp_' . $platform . '_theme_name'])) { // If this isn't set, maybe the AJAX didn't load...
232
  $new_options[$platform]['theme_name'] = trim($postdata['wp_rp_' . $platform . '_theme_name']);
233
+
234
  if(isset($postdata['wp_rp_' . $platform . '_theme_custom_css'])) {
235
  $new_options[$platform]['theme_custom_css'] = $postdata['wp_rp_' . $platform . '_theme_custom_css'];
236
+ } elseif (isset($postdata["wp_rp_${platform}_custom_theme_enabled"])) {
237
  $new_options[$platform]['theme_custom_css'] = '';
238
  }
239
  } else {
252
  if (isset($postdata['wp_rp_turn_on_button_pressed'])) {
253
  $meta['show_turn_on_button'] = false;
254
  $meta['turn_on_button_pressed'] = $postdata['wp_rp_turn_on_button_pressed'];
 
255
  $new_options['desktop']['display_thumbnail'] = true;
256
  }
257
 
258
+ $preprocess_thumbnails = ($new_options['desktop']['display_thumbnail'] && !$old_options['desktop']['display_thumbnail']);
259
 
260
 
261
  $default_thumbnail_path = wp_rp_upload_default_thumbnail_file();
277
  if($new_options['ctr_dashboard_enabled'] && !$old_options['ctr_dashboard_enabled']) {
278
  $meta['show_statistics'] = true;
279
 
280
+ if($new_options['desktop']['display_thumbnail']) {
281
  $meta['show_turn_on_button'] = false;
282
  }
283
 
304
  wp_rp_register_blog($button_type);
305
  }
306
 
307
+ $input_hidden = array(
308
+ 'wp_rp_ajax_nonce' => wp_create_nonce("wp_rp_ajax_nonce"),
309
+ 'wp_rp_json_url' => esc_attr(WP_RP_CONTENT_BASE_URL . WP_RP_STATIC_JSON_PATH),
310
+ 'wp_rp_version' => esc_attr(WP_RP_VERSION),
311
+ 'wp_rp_dashboard_url' => esc_attr(WP_RP_CTR_DASHBOARD_URL),
312
+ 'wp_rp_static_base_url' => esc_attr(WP_RP_STATIC_BASE_URL),
313
+ 'wp_rp_plugin_static_base_url' => esc_attr(plugins_url("static/", __FILE__)),
314
+ );
315
+ if ($options['ctr_dashboard_enabled']) {
316
+ $input_hidden['wp_rp_blog_id'] = esc_attr($meta['blog_id']);
317
+ $input_hidden['wp_rp_auth_key'] = esc_attr($meta['auth_key']);
318
+ }
319
+ if ($meta['show_traffic_exchange'] && $options['traffic_exchange_enabled']) {
320
+ $input_hidden['wp_rp_show_traffic_exchange_statistics'] = '1';
321
+ }
322
+ if ($meta['remote_recommendations'] && $options['promoted_content_enabled']) {
323
+ $input_hidden['wp_rp_show_promoted_content_statistics'] = '1';
324
+ }
325
+
326
+ $settings_file = __FILE__;
327
+
328
+ $form_url = admin_url('admin.php?page=wordpress-related-posts');
329
+ $form_display = ($meta['show_turn_on_button'] && !$meta['turn_on_button_pressed'] && !$meta['blog_id'] ? 'none' : 'block');
330
+
331
+ global $wpdb;
332
+ $custom_fields = $wpdb->get_col( "SELECT meta_key FROM $wpdb->postmeta GROUP BY meta_key HAVING meta_key NOT LIKE '\_%' ORDER BY LOWER(meta_key)" );
333
+
334
+ $exclude_categories = explode(',', $options['exclude_categories']);
335
+ $categories = get_categories(array(
336
+ 'orderby' => 'name',
337
+ 'order' => 'ASC',
338
+ 'hide_empty' => false
339
+ ));
340
+
341
+ include wp_rp_get_template('settings');
342
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
static/css/dashboard.css CHANGED
@@ -10,12 +10,14 @@
10
  #wp_rp_settings_form th,
11
  #wp_rp_settings_form td {padding-left: 0;}
12
 
 
13
  #wp_rp_wrap div#wp_rp_statistics_wrap {position: relative; overflow: hidden;}
14
  #wp_rp_wrap div#wp_rp_statistics_holder {overflow: hidden;}
15
 
16
- #wp_rp_wrap div#wp_rp_statistics_collapsible {float: left; min-width: 600px;}
17
- #wp_rp_wrap div#wp_rp_statistics_collapsible.collapsed {border-bottom: 1px solid #ddd;}
18
- #wp_rp_wrap div#wp_rp_statistics_collapsible.collapsed {border-bottom: 1px solid #ddd;}
 
19
 
20
  #wp_rp_wrap div#wp_rp_statistics_wrap ul.statistics {margin: 0; float: left; width: 600px;}
21
  #wp_rp_wrap.wp_rp_dashboard div#wp_rp_statistics_wrap ul.statistics {float: none; width: auto;}
@@ -26,7 +28,7 @@
26
  #wp_rp_wrap div#wp_rp_statistics_wrap ul.statistics li {position: relative; overflow: hidden; border-bottom: 1px solid #ddd; margin: 0; height: 60px;}
27
  #wp_rp_wrap div#wp_rp_statistics_wrap ul.statistics li h5 {text-transform: uppercase; text-align: center; font-weight: normal; padding: 5px 0; margin: 20px auto 0 auto; font-size: 13px;}
28
  #wp_rp_wrap div#wp_rp_statistics_wrap ul.statistics li h5 span {text-transform: lowercase; font-size: 11px; color: #999; margin-left: 10px;}
29
- #wp_rp_wrap div#wp_rp_statistics_wrap ul.statistics li p.num {position: absolute; right: 0; font-size: 40px; line-height: 40px; color: #82c1cb; font-weight: bold; margin: 10px 0;}
30
  #wp_rp_wrap div#wp_rp_statistics_wrap ul.statistics li p.num.mobile {position: absolute; left: 0;}
31
 
32
  #wp_rp_dashboard_widget #wp_rp_wrap div#wp_rp_statistics_wrap ul.statistics li.clicks {border-bottom: 0;}
@@ -136,14 +138,20 @@ form.wp_rp_message_form a.dismiss {float: right;}
136
  #wp_rp_theme_options_wrap .theme-extra-options {clear: left;}
137
  #wp_rp_theme_options_wrap .custom-theme {clear: both;}
138
 
139
- #wp_rp_theme_options_wrap .wp_rp_settings_table {padding: 15px;border: 1px solid #CCC;width: 630px;margin-bottom: 30px;border-top: 5px solid #CCC;}
140
- #wp_rp_theme_options_wrap .wp_rp_settings_table tbody tr td {padding: 8px 10px;}
141
- #wp_rp_theme_options_wrap .wp_rp_settings_table tbody tr td h4 {font-size: 1.5em;font-weight: normal;}
142
- #wp_rp_theme_options_wrap .wp_rp_settings_table tbody tr td div .theme-extra-options label {}
143
- #wp_rp_theme_options_wrap .wp_rp_settings_table tbody tr td div .theme-extra-options label.selected {}
144
- #wp_rp_theme_options_wrap .wp_rp_settings_table tbody tr td div .theme-extra-options label input {display: none;}
145
 
146
  #wp_rp_theme_custom_css_wrap td {margin: 0; padding-top: 0;}
147
  #wp_rp_theme_custom_css_wrap .notice {margin: 0; padding: 0 0 3px 0; color: #666;}
148
 
149
  #wp_rp_tos {margin-top: 30px;}
 
 
 
 
 
 
 
 
 
10
  #wp_rp_settings_form th,
11
  #wp_rp_settings_form td {padding-left: 0;}
12
 
13
+ #wp_rp_wrap #wp_rp_about_collapsible ul {list-style-type: disc; padding-left: 20px;}
14
  #wp_rp_wrap div#wp_rp_statistics_wrap {position: relative; overflow: hidden;}
15
  #wp_rp_wrap div#wp_rp_statistics_holder {overflow: hidden;}
16
 
17
+
18
+ .settings_block {width: 700px; clear:both; }
19
+ .settings_block.collapsed {border-bottom: 1px solid #ddd;}
20
+ .settings_block.collapsed {border-bottom: 1px solid #ddd;}
21
 
22
  #wp_rp_wrap div#wp_rp_statistics_wrap ul.statistics {margin: 0; float: left; width: 600px;}
23
  #wp_rp_wrap.wp_rp_dashboard div#wp_rp_statistics_wrap ul.statistics {float: none; width: auto;}
28
  #wp_rp_wrap div#wp_rp_statistics_wrap ul.statistics li {position: relative; overflow: hidden; border-bottom: 1px solid #ddd; margin: 0; height: 60px;}
29
  #wp_rp_wrap div#wp_rp_statistics_wrap ul.statistics li h5 {text-transform: uppercase; text-align: center; font-weight: normal; padding: 5px 0; margin: 20px auto 0 auto; font-size: 13px;}
30
  #wp_rp_wrap div#wp_rp_statistics_wrap ul.statistics li h5 span {text-transform: lowercase; font-size: 11px; color: #999; margin-left: 10px;}
31
+ #wp_rp_wrap div#wp_rp_statistics_wrap ul.statistics li p.num {position: absolute; right: 0; font-size: 26px; line-height: 40px; color: #82c1cb; font-weight: bold; margin: 10px 0;}
32
  #wp_rp_wrap div#wp_rp_statistics_wrap ul.statistics li p.num.mobile {position: absolute; left: 0;}
33
 
34
  #wp_rp_dashboard_widget #wp_rp_wrap div#wp_rp_statistics_wrap ul.statistics li.clicks {border-bottom: 0;}
138
  #wp_rp_theme_options_wrap .theme-extra-options {clear: left;}
139
  #wp_rp_theme_options_wrap .custom-theme {clear: both;}
140
 
141
+ .custom-css-container {margin-top: 5px;}
142
+ #wp_rp_wrap form p.end-block { clear: both; margin: 30px 0 0 0; }
143
+
 
 
 
144
 
145
  #wp_rp_theme_custom_css_wrap td {margin: 0; padding-top: 0;}
146
  #wp_rp_theme_custom_css_wrap .notice {margin: 0; padding: 0 0 3px 0; color: #666;}
147
 
148
  #wp_rp_tos {margin-top: 30px;}
149
+
150
+ #wpwrap #wpcontent .wp_rp-updated {position: relative; margin: 5px 0 15px; padding: 1px 12px; background-color: #fff; border-left: 4px solid #f58520; -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);}
151
+ #wpwrap #wpcontent .wp_rp-updated p {font-size: 1.3em;}
152
+ #wpwrap #wpcontent .wp_rp-updated p a {color: inherit; text-decoration: underline;}
153
+ #wpwrap #wpcontent .wp_rp-updated .wp_rp-logo {position: absolute; bottom: 15px; right: 12px;}
154
+ #wpwrap #wpcontent .wp_rp-updated .wp_rp-dismiss {position: absolute;top: 15px;right: 14px;}
155
+ #wpwrap #wpcontent .wp_rp-updated .wp_rp-logo img {width: 90px;}
156
+ #wpwrap #wpcontent .wp_rp-updated .wp_rp-dismiss a:before {content: '\f153'; display: inline-block; font: 400 16px/1 dashicons; speak: none; height: 20px; margin: 2px 0; text-align: center; vertical-align: middle; width: 20px; -webkit-font-smoothing: antialiased!important;}
157
+ #wpwrap h2.title span {font-size:0.5em;}
static/js/dashboard.js CHANGED
@@ -1,11 +1,12 @@
1
- (function(a){var e=function(b,e){a.each(e,function(a,e){b=b.replace(RegExp("{{ *"+a+" *}}"),e)});return b};a(function(){var b=a("#wp_rp_earnings_wrap"),j=a("#wp_rp_earnings_holder"),f=a("#wp_rp_statistics_wrap"),k=a("#wp_rp_dashboard_url").val(),h=a("#wp_rp_blog_id").val(),i=a("#wp_rp_auth_key").val(),g=a("#wp_rp_ajax_nonce").val();traffic_exchange_enabled=0<a("#wp_rp_show_traffic_exchange_statistics").length;promoted_content_enabled=0<a("#wp_rp_show_promoted_content_statistics").length;update_interval=
2
- req_timeout=null;update_interval_sec=5E3;update_interval_error_sec=3E4;updating=!1;ul=null;stats={};set_update_interval=function(a){a||(a=update_interval_sec);clearInterval(update_interval);0<a&&(update_interval=setInterval(update_dashboard,a))};display_error=function(c){var l=a("#wp_rp_statistics_wrap");c||l.find(".unavailable").slideDown();set_update_interval(update_interval_error_sec);updating=!1};create_dashboard=function(){ul=a('<ul class="statistics" />');f.find(".unavailable").slideUp();ul.append('<li class="title"><div class="desktop">Desktop</div><div class="mobile">Mobile</div></li>');
3
- ul.append(e('<li class="{{class}} stats"><p class="num mobile"></p><p class="num all"></p><h5>{{ title}}<span>{{range}}</span></h5></li>',{"class":"ctr",title:"click-through rate",range:"last 30 days"}));ul.append(e('<li class="{{class}} stats"><p class="num mobile"></p><p class="num all"></p><h5>{{ title}}<span>{{range}}</span></h5></li>',{"class":"pageviews",title:"page views",range:"last 30 days"}));ul.append(e('<li class="{{class}} stats"><p class="num mobile"></p><p class="num all"></p><h5>{{ title}}<span>{{range}}</span></h5></li>',
4
- {"class":"clicks",title:"clicks",range:"last 30 days"}));f.append(ul);traffic_exchange_enabled&&f.append('<div class="network"><div class="icon"></div><span class="num"></span><h4>Inbound Visitors</h4><div class="description"><p>Number of visitors that came to your site because this plugin promoted your content on other sites.<strong>Wow, a traffic exchange! :)</strong></p></div></div>')};update_dashboard=function(c){updating||(updating=!0,req_timeout=setTimeout(function(){display_error(!c)},2E3),
5
- a.getJSON(k+"pageviews/?callback=?",{blog_id:h,auth_key:i},function(a){var d=a.data;clearTimeout(req_timeout);if(!a||"ok"!==a.status||!a.data)display_error(!c);else{ul||create_dashboard();set_update_interval(a.data.update_interval);stats.mobile_pageviews=Math.max(d.mobile_pageviews,stats.mobile_pageviews||0);stats.mobile_clicks=Math.max(d.mobile_clicks,stats.mobile_clicks||0);a=0<stats.mobile_pageviews&&(100*(stats.mobile_clicks/stats.mobile_pageviews)).toFixed(1)||0;stats.desktop_pageviews=Math.max(d.pageviews-
6
- stats.mobile_pageviews,stats.desktop_pageviews||0);stats.desktop_clicks=Math.max(d.clicks-stats.mobile_clicks,stats.desktop_clicks||0);var e=0<stats.desktop_pageviews&&(100*(stats.desktop_clicks/stats.desktop_pageviews)).toFixed(1)||0;stats.network_in_pageviews=Math.max(d.network_in_pageviews,stats.network_in_pageviews||0);if(promoted_content_enabled&&d.promoted_content_money_earned){stats.promoted_content_money_earned=Math.max(d.promoted_content_money_earned,stats.promoted_content_money_earned||
7
- 0);var m=(stats.promoted_content_money_earned/100).toFixed(2),g=(d.meta.min_payout/100).toFixed(2);b.find(".num").html("$"+m);b.find(".payout").html("$"+g);stats.promoted_content_money_earned>=d.meta.min_payout&&b.find(".claim").hasClass("disabled")&&(b.find(".claim").removeClass("disabled"),b.find(".claim").attr("href","mailto:support+claim@zemanta.com?subject="+encodeURIComponent("I earned over $50!")+"&body="+encodeURIComponent("I would like to claim my money.\nMy reference code is: "+h+" \nMy PayPal account is:\n")));
8
- j.show()}ul.find(".ctr .num.all").html(e+"%");ul.find(".pageviews .num.all").html(stats.desktop_pageviews);ul.find(".clicks .num.all").html(stats.desktop_clicks);ul.find(".ctr .num.mobile").html(a+"%");ul.find(".pageviews .num.mobile").html(stats.mobile_pageviews);ul.find(".clicks .num.mobile").html(stats.mobile_clicks);f.find(".network .num").html(stats.network_in_pageviews);updating=!1}}))};turn_on_rp=function(c){a("#wp_rp_static_base_url").val();a("#wp_rp_ctr_dashboard_enabled, #wp_rp_enable_themes, #wp_rp_promoted_content_enabled, #wp_rp_traffic_exchange_enabled").prop("checked",
9
- !0);a("#wp_rp_settings_form").append('<input type="hidden" value="statistics+thumbnails+promoted" name="wp_rp_turn_on_button_pressed" id="wp_rp_turn_on_button_pressed">');a("#wp_rp_settings_form").append('<input type="hidden" value="'+c+'" name="wp_rp_button_type" id="wp_rp_button_type">');a("#wp_rp_settings_form").submit()};h&&i&&(update_dashboard(!0),update_interval=setInterval(update_dashboard,2E3));!h&&document.location.search.match(/ref=turn-on-rp/)&&turn_on_rp("turn-on-banner");a("#wp_rp_turn_on_statistics a.turn-on").click(function(c){c.preventDefault();
10
- c=a(this).data("type");turn_on_rp(c)});a(".wp_rp_notification .close").on("click",function(c){a.ajax({url:a(this).attr("href"),data:{noredirect:!0},_wpnonce:g});a(this).parent().slideUp(function(){a(this).remove()});c.preventDefault()});a("#wp_rp_wrap .collapsible .collapse-handle").on("click",function(c){var b=a(this).closest(".collapsible"),d=b.find(".container"),e=b.hasClass("collapsed"),f=b.attr("block");e?(d.slideDown(),a.post(ajaxurl,{action:"rp_show_hide_"+f,show:!0,_wpnonce:g})):(d.slideUp(),
11
- a.post(ajaxurl,{action:"rp_show_hide_"+f,hide:!0,_wpnonce:g}));b.toggleClass("collapsed");c.preventDefault()})})})(jQuery);
 
1
+ (function(a){var h=function(f,h){a.each(h,function(a,h){f=f.replace(RegExp("{{ *"+a+" *}}"),h)});return f};a(function(){var f=a("#wp_rp_earnings_wrap"),C=a("#wp_rp_earnings_holder"),i=a("#wp_rp_statistics_wrap"),D=a("#wp_rp_dashboard_url").val(),m=a("#wp_rp_blog_id").val(),v=a("#wp_rp_auth_key").val(),n=a("#wp_rp_ajax_nonce").val(),E=0<a("#wp_rp_show_traffic_exchange_statistics").length,F=0<a("#wp_rp_show_promoted_content_statistics").length,w=null,s=null,p=!1,d=null,j,k,l,q,t,r,x=function(a){a||
2
+ (a=5E3);clearInterval(s);0<a&&(s=setInterval(u,a))},y=function(c,b){a.ajax({url:ajaxurl,data:{action:"wprp_subscribe",_wpnonce:n,email:c||"0"},success:b,type:"POST"})},z=function(){var c=1!==a("#wp_rp_desktop_custom_theme_enabled:checked").length;a("#wp_rp_desktop_theme_custom_css").prop("readonly",c)},A=function(c){var b=a("#wp_rp_statistics_wrap");c||b.find(".unavailable").slideDown();x(3E4);p=!1},u=function(c){p||(p=!0,w=setTimeout(function(){A(!c)},2E3),a.getJSON(D+"pageviews/?callback=?",{blog_id:m,
3
+ auth_key:v},function(b){var e=b.data;clearTimeout(w);if(!b||"ok"!==b.status||!b.data)A(!c);else{d||(d=a('<ul class="statistics" />'),i.find(".unavailable").slideUp(),d.append('<li class="title"><div class="desktop">Desktop</div><div class="mobile">Mobile</div></li>'),d.append(h('<li class="{{class}} stats"><p class="num mobile"></p><p class="num all"></p><h5>{{ title}}<span>{{range}}</span></h5></li>',{"class":"ctr",title:"click-through rate",range:"last 30 days"})),d.append(h('<li class="{{class}} stats"><p class="num mobile"></p><p class="num all"></p><h5>{{ title}}<span>{{range}}</span></h5></li>',
4
+ {"class":"pageviews",title:"page views",range:"last 30 days"})),d.append(h('<li class="{{class}} stats"><p class="num mobile"></p><p class="num all"></p><h5>{{ title}}<span>{{range}}</span></h5></li>',{"class":"clicks",title:"clicks",range:"last 30 days"})),i.append(d),E&&i.append('<div class="network"><div class="icon"></div><span class="num"></span><h4>Inbound Visitors</h4><div class="description"><p>Number of visitors that came to your site because this plugin promoted your content on other sites.<strong>Wow, a traffic exchange! :)</strong></p></div></div>'),
5
+ i.parents(".collapsed").length&&i.parent().hide());x(b.data.update_interval);j=Math.max(e.mobile_pageviews,j||0);k=Math.max(e.mobile_clicks,k||0);b=0<j&&(100*(k/j)).toFixed(1)||0;l=Math.max(e.pageviews-j,l||0);q=Math.max(e.clicks-k,q||0);var G=0<l&&(100*(q/l)).toFixed(1)||0;t=Math.max(e.network_in_pageviews,t||0);if(F&&e.promoted_content_money_earned){r=Math.max(e.promoted_content_money_earned,r||0);var g=(r/100).toFixed(2),H=(e.meta.min_payout/100).toFixed(2);f.find(".num").html("$"+g);f.find(".payout").html("$"+
6
+ H);r>=e.meta.min_payout&&f.find(".claim").hasClass("disabled")&&(f.find(".claim").removeClass("disabled"),f.find(".claim").attr("href","mailto:support+claim@zemanta.com?subject="+encodeURIComponent("I earned over $50!")+"&body="+encodeURIComponent("I would like to claim my money.\nMy reference code is: "+m+" \nMy PayPal account is:\n")));C.show()}d.find(".ctr .num.all").html(G+"%");d.find(".pageviews .num.all").html(l);d.find(".clicks .num.all").html(q);d.find(".ctr .num.mobile").html(b+"%");d.find(".pageviews .num.mobile").html(j);
7
+ d.find(".clicks .num.mobile").html(k);i.find(".network .num").html(t);p=!1}}))},B=function(c){a("#wp_rp_static_base_url").val();a("#wp_rp_ctr_dashboard_enabled, #wp_rp_enable_themes, #wp_rp_promoted_content_enabled, #wp_rp_traffic_exchange_enabled").prop("checked",!0);a("#wp_rp_settings_form").append('<input type="hidden" value="statistics+thumbnails+promoted" name="wp_rp_turn_on_button_pressed" id="wp_rp_turn_on_button_pressed">');a("#wp_rp_settings_form").append('<input type="hidden" value="'+c+
8
+ '" name="wp_rp_button_type" id="wp_rp_button_type">');a("#wp_rp_settings_form").submit()};z();a("#wp_rp_desktop_custom_theme_enabled").click(z);m&&v&&(u(!0),s=setInterval(u,2E3));!m&&document.location.search.match(/ref=turn-on-rp/)&&B("turn-on-banner");a("#wp_rp_turn_on_statistics a.turn-on").click(function(c){c.preventDefault();c=a(this).data("type");B(c)});a("#wp_rp_subscribe_email").length&&(a("#wp_rp_subscribe_email").val().length?a("#wp_rp_subscribe_button").hide():a("#wp_rp_unsubscribe_button").hide());
9
+ a("#wp_rp_subscribe_button").on("click",function(c){var b=a("#wp_rp_subscribe_email").val();c.preventDefault();b&&(a("#wp_rp_subscribe_button").prop("disabled",!0),y(b,function(b){parseInt(b)&&(a("#wp_rp_subscribe_button").prop("disabled",!1),a("#wp_rp_subscribe_button").hide(),a("#wp_rp_unsubscribe_button").show(),alert("Subscription successful!"))}))});a("#wp_rp_unsubscribe_button").on("click",function(c){c.preventDefault();a("#wp_rp_unsubscribe_button").prop("disabled",!0);y(!1,function(b){parseInt(b)&&
10
+ (a("#wp_rp_subscribe_email").val(""),a("#wp_rp_unsubscribe_button").prop("disabled",!1),a("#wp_rp_unsubscribe_button").hide(),a("#wp_rp_subscribe_button").show())})});a(".wp_rp_notification .close").on("click",function(c){a.ajax({url:a(this).attr("href"),data:{noredirect:!0},_wpnonce:n});a(this).parent().slideUp(function(){a(this).remove()});c.preventDefault()});a("#wp_rp_wrap .collapsible .collapse-handle").on("click",function(c){var b=a(this).closest(".collapsible"),e=b.find(".container"),d=b.hasClass("collapsed"),
11
+ g=b.attr("block");d?(e.slideDown(),a.post(ajaxurl,{action:"rp_show_hide_"+g,show:!0,_wpnonce:n})):(e.slideUp(),a.post(ajaxurl,{action:"rp_show_hide_"+g,hide:!0,_wpnonce:n}));b.toggleClass("collapsed");if("statistics"===g){var g="statistics_"+(d?"on":"off"),e=void 0,b=new Image,d="https:"===location.protocol?"https://":"http://",g={"zem-habit-platform":"wordpress-wprp","zem-habit-action":g,"zem-habit-timestamp":(new Date).getTime()},e=e||{},g=a.extend(e,g),e=d+"eyepatch.zemanta.com/log/?",f="";a.each(g,
12
+ function(a,b){f+=a+"="+encodeURIComponent(b)+"&"});d=f.slice(0,f.length-1);b.src=e+d}c.preventDefault()})})})(jQuery);
static/js/themes.js CHANGED
@@ -1,5 +1,5 @@
1
- (function(a){a(function(){var h=a("#wp_rp_plugin_static_base_url").val();platforms={mobile:{wrap:a("#wp_rp_mobile_theme_options_wrap"),theme_area:a("#wp_rp_mobile_theme_area"),current_theme:a("#wp_rp_mobile_theme_selected").val()},desktop:{wrap:a("#wp_rp_desktop_theme_options_wrap"),theme_area:a("#wp_rp_desktop_theme_area"),current_theme:a("#wp_rp_desktop_theme_selected").val()}};themes={mobile:[{name:"Modern",location:"m-modern.css"},{name:"Infinite Stream (experimental)",location:"m-stream.css"},
2
- {name:"Plain (your own css)",location:"m-plain.css"}],desktop:[{name:"Momma",location:"momma.css"},{name:"Modern",location:"modern.css"},{name:"Vertical (Large)",location:"vertical.css"},{name:"Vertical (Medium)",location:"vertical-m.css"},{name:"Vertical (Small)",location:"vertical-s.css"},{name:"Pinterest Inspired",location:"pinterest.css"},{name:"Two Columns",location:"twocolumns.css"},{name:"Plain (your own css)",location:"plain.css"}]};update_themes=function(){a.each(platforms,function(b,e){var d=
3
- e.wrap.find("div.theme-list"),f=e.wrap.find("div.theme-screenshot"),g=function(b){if(b.val()){var b=h+"img/themes/"+b.val().replace(/\.css$/,".jpg"),c=f.find("img");if(c.length){if(c.attr("src")===b)return}else c=a("<img />"),f.html(c);c.attr("src",b)}else f.html("")};d.empty();a.each(themes[b],function(a,c){"custom.css"!=c.location&&d.append('<label class="theme-label"><input '+(c.location===e.current_theme?'checked="checked"':"")+' class="theme-option" type="radio" name="wp_rp_'+b+'_theme_name" value="'+
4
- c.location+'" /> '+c.name+"</label><br />")});d.on("hover","label.theme-label",function(){g(a("input",this))});d.on("mouseleave",function(){g(d.find("input:checked"))});g(d.find("input:checked"));e.theme_area.show()})};update_custom_css_area=function(b){var e=a("#wp_rp_"+b+"_custom_theme_enabled:checked"),d=a("#wp_rp_"+b+"_theme_custom_css_wrap");e.length?(d.show(),e.closest("label").addClass("wp_rp_settings_button_disabled")):(d.hide(),a("#wp_rp_"+b+"_custom_theme_enabled").closest("label").removeClass("wp_rp_settings_button_disabled"))};
5
- a.each(platforms,function(b){update_custom_css_area(b);a("#wp_rp_"+b+"_custom_theme_enabled").on("change",function(){update_custom_css_area(b)})});a("#wp_rp_enable_themes:checked").length&&(update_themes(),a("#wp_rp_theme_options_wrap").show());a("#wp_rp_enable_themes").change(function(){a("#wp_rp_enable_themes:checked").length?append_get_themes_script():a("#wp_rp_theme_options_wrap").hide()})})})(jQuery);
1
+ (function(a){a(function(){var k=a("#wp_rp_plugin_static_base_url").val();a("#wp_rp_static_base_url").val();var l=a("#wp_rp_json_url").val(),m=a("#wp_rp_version").val(),n={mobile:{wrap:a("#wp_rp_mobile_theme_options_wrap"),theme_area:a("#wp_rp_mobile_theme_area"),current_theme:a("#wp_rp_mobile_theme_selected").val()},desktop:{wrap:a("#wp_rp_desktop_theme_options_wrap"),theme_area:a("#wp_rp_desktop_theme_area"),current_theme:a("#wp_rp_desktop_theme_selected").val()}},h={mobile:[{name:"Modern",location:"m-modern.css"},
2
+ {name:"Infinite Stream (experimental)",location:"m-stream.css"},{name:"Plain (your own css)",location:"m-plain.css"}],desktop:[{name:"Momma",location:"momma.css"},{name:"Modern",location:"modern.css"},{name:"Vertical (Large)",location:"vertical.css"},{name:"Vertical (Medium)",location:"vertical-m.css"},{name:"Vertical (Small)",location:"vertical-s.css"},{name:"Pinterest Inspired",location:"pinterest.css"},{name:"Two Columns",location:"twocolumns.css"},{name:"Plain (your own css)",location:"plain.css"}]},
3
+ i=function(){a.each(n,function(b,d){var e=d.wrap.find("div.theme-list"),f=d.wrap.find("div.theme-screenshot"),g=function(b){if(b.val()){var b=k+"img/themes/"+b.val().replace(/\.css$/,".jpg"),c=f.find("img");if(c.length){if(c.attr("src")===b)return}else c=a("<img />"),f.html(c);c.attr("src",b)}else f.html("")};e.empty();a.each(h[b],function(a,c){"custom.css"!=c.location&&e.append('<label class="theme-label"><input '+(c.location===d.current_theme?'checked="checked"':"")+' class="theme-option" type="radio" name="wp_rp_'+
4
+ b+'_theme_name" value="'+c.location+'" /> '+c.name+"</label><br />")});e.on("hover","label.theme-label",function(){g(a("input",this))});e.on("mouseleave",function(){g(e.find("input:checked"))});g(e.find("input:checked"));d.theme_area.show()})},j=!1;window.wp_rp_themes_cb=function(b){if(b&&b.themes&&(h=b.themes))j=!0,i();j&&a("#wp_rp_theme_options_wrap").show()};a("#wp_rp_enable_themes:checked").length&&(i(),a("#wp_rp_theme_options_wrap").show());a("#wp_rp_enable_themes").change(function(){if(a("#wp_rp_enable_themes:checked").length){var b=
5
+ document.createElement("script"),d=document.getElementsByTagName("body").item(0);b.type="text/javascript";b.src=l+"themes2.js?plv="+m;d.appendChild(b)}else a("#wp_rp_theme_options_wrap").hide()})})})(jQuery);
views/admin_head.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <style type="text/css">
2
+ #toplevel_page_wordpress-related-posts .wp-menu-image {
3
+ background: url('<?php echo $menu_icon; ?>') 7px 6px no-repeat;
4
+ }
5
+ @media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
6
+ #toplevel_page_wordpress-related-posts .wp-menu-image {
7
+ background-image: url('<?php echo $menu_icon_retina; ?>');
8
+ background-size: 16px 16px;
9
+ }
10
+ }
11
+ </style>
views/global_notice.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <div class="updated wp_rp-updated" id="wp_rp-top-global-notice" >
2
+ <div class="wp_rp-dismiss"><a href="<?php echo $close_url; ?>">Dismiss and go to settings</a></div>
3
+ <h3><?php echo $notice['title']; ?></h3>
4
+ <p class="wp_rp-about-description"><?php echo $notice['message']; ?></p>
5
+ </div>
views/settings.php ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap" id="wp_rp_wrap">
2
+ <?php foreach($input_hidden as $id => $value): ?>
3
+ <input type="hidden" id="<?php echo $id; ?>" value="<?php echo $value; ?>" />
4
+ <?php endforeach; ?>
5
+ <?php do_action('wp_rp_admin_notices'); ?>
6
+ <!-- HEADER AND SUPPORT -->
7
+ <div class="header">
8
+ <div class="support">
9
+ <h4><?php _e("Awesome support", 'wp_related_posts'); ?></h4>
10
+ <p>
11
+ <?php _e("If you have any questions please contact us at",'wp_related_posts');?> <a target="_blank" href="mailto:support+wprp@zemanta.com"><?php _e("support", 'wp_related_posts');?></a>.
12
+ </p>
13
+ </div>
14
+ <h2 class="title">
15
+ <?php _e("Wordpress Related Posts",'wp_related_posts');?>
16
+ <span>
17
+ <?php _e("by",'wp_related_posts');?>
18
+ <a href="http://www.zemanta.com">Zemanta</a>
19
+ </span>
20
+ </h2>
21
+ </div>
22
+ <!-- NOTIFICATIONS -->
23
+ <?php wp_rp_print_notifications(); ?>
24
+
25
+ <?php if($meta['show_turn_on_button']): ?>
26
+ <!-- TURN ON STATISTICS PROMO -->
27
+ <div id="wp_rp_turn_on_statistics">
28
+ <div class="turn_on_wrap">
29
+ <h4>Turn on Related Posts and start using awesome features.</h4>
30
+ <div class="button_wrap">
31
+ <a data-type="singlebutton" href="#" class="zemanta-button turn-on">Turn on Related Posts</a>
32
+ </div>
33
+ <p>By turning on Related Posts you agree to <a href="http://www.zemanta.com/rp-tos" target="_blank">terms of service.</a></p>
34
+ <p>You'll get Advanced Settings, Themes, Thumbnails and Analytics Dashboard. These features are provided by <a target="_blank" href="http://www.zemanta.com">Zemanta</a> as a service.</p>
35
+ </div>
36
+ <img class="screendesc" src="<?php echo plugins_url("static/img/turnonscreen.jpg", $settings_file); ?>" />
37
+ </div>
38
+ <?php endif; ?>
39
+
40
+ <h2><?php _e('Subscribe to plugin updates and newsletter', 'wp_related_posts'); ?></h2>
41
+ <div class="container">
42
+ <table class="form-table subscription-block">
43
+ <tr valign="top">
44
+ <th scope="row">
45
+ <?php _e('Email:', 'wp_related_posts'); ?>
46
+ </th>
47
+ <td>
48
+ <input type="text" id="wp_rp_subscribe_email" value="<?php esc_attr_e($meta['email']); ?>" class="regular-text" />
49
+ <a id="wp_rp_subscribe_button" href="#" class="button-primary"><?php _e('Subscribe', 'wp_related_posts'); ?></a>
50
+ <a id="wp_rp_unsubscribe_button" href="#" class="button-primary"><?php _e('Unsubscribe', 'wp_related_posts'); ?></a>
51
+ </td>
52
+ </tr>
53
+ </table>
54
+ </div>
55
+
56
+ <!-- MAIN FORM -->
57
+ <form method="post" enctype="multipart/form-data" action="<?php echo $form_url; ?>" id="wp_rp_settings_form" style="display: <?php echo $form_display; ?>;">
58
+ <?php wp_nonce_field('wp_rp_settings', '_wp_rp_nonce') ?>
59
+
60
+ <?php if ($options['ctr_dashboard_enabled']): ?>
61
+ <div id="wp_rp_earnings_holder" style="display:none;">
62
+ <h2><?php _e('Earnings', 'wp_related_posts'); ?></h2>
63
+ <div class="container">
64
+ <p>By displaying promoted posts on your site you've already earned:</p>
65
+ <div id="wp_rp_earnings_wrap">
66
+ <span class="num"></span>
67
+ <a href="#" class="claim disabled">claim
68
+ <span class="payout-explain">You can claim the money when it reaches <span class="payout"></span>.</span>
69
+ </a>
70
+ </div>
71
+ </div>
72
+ </div>
73
+ <div id="wp_rp_statistics_holder">
74
+ <div id="wp_rp_statistics_collapsible" block="statistics" class="settings_block collapsible collapsed">
75
+ <a href="#" class="collapse-handle">Collapse</a>
76
+ <h2><?php _e('Statistics', 'wp_related_posts'); ?></h2>
77
+ <div class="container" <?php echo !$meta['show_statistics'] ? 'style="display: none;" ' : ''; ?>>
78
+ <div id="wp_rp_statistics_wrap">
79
+ <div class="message unavailable"><?php _e("Statistics currently unavailable",'wp_related_posts'); ?></div>
80
+ </div>
81
+ </div>
82
+ </div>
83
+ </div>
84
+ <?php endif; ?>
85
+ <div id="wp_rp_basic_settings_collapsible" block="basic_settings" class="settings_block collapsible">
86
+ <a href="#" class="collapse-handle">Collapse</a>
87
+ <h2><?php _e("Basic settings",'wp_related_posts');?></h2>
88
+ <div class="container">
89
+ <table class="form-table">
90
+ <tr valign="top">
91
+ <th scope="row">
92
+ <?php _e('Related Posts Title:', 'wp_related_posts'); ?>
93
+ </th>
94
+ <td>
95
+ <input name="wp_rp_related_posts_title" type="text" id="wp_rp_related_posts_title" value="<?php esc_attr_e($options['related_posts_title']); ?>" class="regular-text" />
96
+ </td>
97
+ </tr>
98
+ <tr valign="top">
99
+ <th scope="row">
100
+ <?php _e('Number of Posts:', 'wp_related_posts');?>
101
+ </th>
102
+ <td>
103
+ <input name="wp_rp_max_related_posts" type="number" step="1" id="wp_rp_max_related_posts" class="small-text" min="1" value="<?php esc_attr_e($options['max_related_posts']); ?>" />
104
+ </td>
105
+ </tr>
106
+ </table>
107
+ </div>
108
+ </div>
109
+ <div id="wp_rp_advanced_settings_collapsible" block="advanced_settings" class="settings_block collapsible collapsed">
110
+ <a href="#" class="collapse-handle">Collapse</a>
111
+ <h2><?php _e("Advanced settings",'wp_related_posts');?></h2>
112
+ <div class="container" style="display: none">
113
+ <h3><?php _e("Themes",'wp_related_posts'); ?></h3>
114
+ <label>
115
+ <input name="wp_rp_enable_themes" type="checkbox" id="wp_rp_enable_themes" value="yes"<?php checked($options["enable_themes"]); ?> />
116
+ <?php _e("Enable Themes",'wp_related_posts'); ?>*
117
+ </label>
118
+
119
+ <h4><?php _e("Layout",'wp_related_posts'); ?></h4>
120
+ <div id="wp_rp_theme_options_wrap" style="display:none;">
121
+ <input type="hidden" id="wp_rp_desktop_theme_selected" value="<?php esc_attr_e($options['desktop']['theme_name']); ?>" />
122
+ <div id="wp_rp_desktop_theme_options_wrap">
123
+ <div id="wp_rp_desktop_theme_area" style="display: none;">
124
+ <div class="theme-list"></div>
125
+ <div class="theme-screenshot"></div>
126
+ </div>
127
+ </div>
128
+ </div>
129
+ <h3><?php _e("Customize",'wp_related_posts'); ?></h3>
130
+ <div id="wp_rp_desktop_theme_custom_css_wrap">
131
+ <label>
132
+ <input name="wp_rp_desktop_display_thumbnail" type="checkbox" id="wp_rp_desktop_display_thumbnail" value="yes" <?php checked($options['desktop']["display_thumbnail"]); ?> >
133
+ <?php _e("Display Thumbnails For Related Posts",'wp_related_posts');?>
134
+ </label><br />
135
+ <label>
136
+ <input name="wp_rp_desktop_display_comment_count" type="checkbox" id="wp_rp_desktop_display_comment_count" value="yes" <?php checked($options['desktop']["display_comment_count"]); ?>>
137
+ <?php _e("Display Number of Comments",'wp_related_posts');?>
138
+ </label><br />
139
+ <label>
140
+ <input name="wp_rp_desktop_display_publish_date" type="checkbox" id="wp_rp_desktop_display_publish_date" value="yes" <?php checked($options['desktop']["display_publish_date"]); ?>>
141
+ <?php _e("Display Publish Date",'wp_related_posts');?>
142
+ </label><br />
143
+ <label>
144
+ <input name="wp_rp_desktop_display_excerpt" type="checkbox" id="wp_rp_desktop_display_excerpt" value="yes" <?php checked($options['desktop']["display_excerpt"]); ?>>
145
+ <?php _e("Display Post Excerpt",'wp_related_posts');?>
146
+ </label>
147
+ <label id="wp_rp_desktop_excerpt_max_length_label">
148
+ <input name="wp_rp_desktop_excerpt_max_length" type="text" id="wp_rp_desktop_excerpt_max_length" class="small-text" value="<?php esc_attr_e($options['desktop']["excerpt_max_length"]); ?>" /> <span class="description"><?php _e('Maximum Number of Characters.', 'wp_related_posts'); ?></span>
149
+ </label><br />
150
+ <label>
151
+ <input type="checkbox" id="wp_rp_desktop_custom_theme_enabled" name="wp_rp_desktop_custom_theme_enabled" value="yes" <?php checked($options['desktop']['custom_theme_enabled']); ?> />
152
+ <?php _e("Enable custom CSS",'wp_related_posts'); ?>
153
+ </label>
154
+ <div class="custom-css-container">
155
+ <textarea style="clear: both; width: 300px; height: 215px; background: #EEE;" id="wp_rp_desktop_theme_custom_css" name="wp_rp_desktop_theme_custom_css" class="custom-css"><?php echo htmlspecialchars($options['desktop']['theme_custom_css'], ENT_QUOTES); ?></textarea>
156
+ </div>
157
+ <h4><?php _e("Default thumbnails",'wp_related_posts'); ?></h4>
158
+ <label>
159
+ <?php _e('For posts without images, a default image will be shown.<br/>
160
+ You can upload your own default image here','wp_related_posts');?>
161
+ <input type="file" name="wp_rp_default_thumbnail" />
162
+ </label>
163
+ <?php if($options['default_thumbnail_path']) : ?>
164
+ <span style="display: inline-block; vertical-align: top; *display: inline; zoom: 1;">
165
+ <img style="padding: 3px; border: 1px solid #DFDFDF; border-radius: 3px;" valign="top" width="80" height="80" src="<?php esc_attr_e(wp_rp_get_default_thumbnail_url()); ?>" alt="selected thumbnail" />
166
+ <br />
167
+ <label>
168
+ <input type="checkbox" name="wp_rp_default_thumbnail_remove" value="yes" />
169
+ <?php _e("Remove selected",'wp_related_posts');?>
170
+ </label>
171
+ </span>
172
+ <?php endif; ?>
173
+
174
+ <?php if($custom_fields): ?>
175
+ <br />
176
+ <br />
177
+ <label><input name="wp_rp_thumbnail_use_custom" type="checkbox" value="yes" <?php checked($options['thumbnail_use_custom']); ?>> Use custom field for thumbnails</label>
178
+ <select name="wp_rp_thumbnail_custom_field" id="wp_rp_thumbnail_custom_field" class="postform">
179
+
180
+ <?php foreach ( $custom_fields as $custom_field ) : ?>
181
+ <option value="<?php esc_attr_e($custom_field); ?>"<?php selected($options["thumbnail_custom_field"], $custom_field); ?>><?php esc_html_e($custom_field);?></option>
182
+ <?php endforeach; ?>
183
+ </select>
184
+ <br />
185
+ <?php endif; ?>
186
+ <h4><?php _e("Custom size thumbnails",'wp_related_posts'); ?></h4>
187
+ <div>If you want to use custom sizes, override theme's CSS rules in the Custom CSS section under Theme Settings above.
188
+ </div>
189
+ <label>
190
+ <input name="wp_rp_custom_size_thumbnail_enabled" type="checkbox" id="wp_rp_custom_size_thumbnail_enabled" value="yes" <?php checked($options['custom_size_thumbnail_enabled']); ?> />
191
+ <?php _e("Use Custom Size Thumbnails",'wp_related_posts');?>
192
+ </label><br />
193
+ <div id="wp_rp_custom_thumb_sizes_settings" style="display:none">
194
+ <label>
195
+ <?php _e("Custom Width (px)",'wp_related_posts');?>
196
+ <input name="wp_rp_custom_thumbnail_width" type="text" id="wp_rp_custom_thumbnail_width" class="small-text" value="<?php esc_attr_e($options['custom_thumbnail_width']); ?>" />
197
+ </label>
198
+ <label>
199
+ <?php _e("Custom Height (px)",'wp_related_posts');?>
200
+ <input name="wp_rp_custom_thumbnail_height" type="text" id="wp_rp_custom_thumbnail_height" class="small-text" value="<?php esc_attr_e($options['custom_thumbnail_height']); ?>" />
201
+ </label>
202
+ </div>
203
+ </div>
204
+ <h3><?php _e("Other Settings",'wp_related_posts'); ?></h3>
205
+ <table class="form-table">
206
+ <tr valign="top">
207
+ <th scope="row"><?php _e('Exclude these Categories:', 'wp_related_posts'); ?></th>
208
+ <td>
209
+ <div class="excluded-categories">
210
+ <?php foreach ($categories as $category): ?>
211
+ <label>
212
+ <input name="wp_rp_exclude_categories[]" type="checkbox" id="wp_rp_exclude_categories" value="<?php esc_attr_e($category->cat_ID); ?>"<?php checked(in_array($category->cat_ID, $exclude_categories)); ?> />
213
+ <?php esc_html_e($category->cat_name); ?>
214
+ <br />
215
+ </label>
216
+ <?php endforeach; ?>
217
+ </div>
218
+ </td>
219
+ </tr>
220
+ <tr valign="top">
221
+ <td colspan="2"><?php if(strpos(get_bloginfo('language'), 'en') === 0 || $meta['classic_user']): ?>
222
+ <div>
223
+ <label>
224
+ <input type="checkbox" name="wp_rp_only_admins_can_edit_related_posts" id="wp_rp_only_admins_can_edit_related_posts" value="yes" <?php checked($options['only_admins_can_edit_related_posts']); ?> />
225
+ <?php _e("Only admins can edit Related Posts",'wp_related_posts');?>
226
+ </label>
227
+ </div>
228
+ <label>
229
+ <input name="wp_rp_classic_state" type="checkbox" id="wp_rp_classic_state" value="yes" <?php checked($meta['classic_user']); ?>>
230
+ <?php _e("Display widget with <a href=\"http://support.zemanta.com/customer/portal/articles/1423148-why-should-i-add-related-articles-from-around-the-web-\" target=\"blank\">articles from around the web</a> in your \"Compose-new-post\" page",'wp_related_posts');?>
231
+ </label><?php endif; ?>
232
+ <br/>
233
+ <label>
234
+ <input name="wp_rp_on_single_post" type="checkbox" id="wp_rp_on_single_post" value="yes" <?php checked($options['on_single_post']); ?>>
235
+ <?php _e("Auto Insert Related Posts",'wp_related_posts');?>
236
+ </label>
237
+ (or add <pre style="display: inline">&lt;?php wp_related_posts()?&gt;</pre> to your single post template)
238
+ <br />
239
+ <label>
240
+ <input name="wp_rp_on_rss" type="checkbox" id="wp_rp_on_rss" value="yes"<?php checked($options['on_rss']); ?>>
241
+ <?php _e("Display Related Posts in Feed",'wp_related_posts');?>
242
+ </label>
243
+ <br />
244
+ <label>
245
+ <input name="wp_rp_ctr_dashboard_enabled" type="checkbox" id="wp_rp_ctr_dashboard_enabled" value="yes" <?php checked($options['ctr_dashboard_enabled']); ?> />
246
+ <?php _e("Turn statistics on",'wp_related_posts');?>*
247
+ </label>
248
+ <br />
249
+ <div style="display:<?php echo $meta['show_traffic_exchange'] ? 'block' : 'none' ?>;">
250
+ <label>
251
+ <input name="wp_rp_traffic_exchange_enabled" type="checkbox" id="wp_rp_traffic_exchange_enabled" value="yes"<?php checked($options['traffic_exchange_enabled']); ?>>
252
+ <?php _e("Enable traffic exchange with blogger networks",'wp_related_posts');?>
253
+ </label>
254
+ </div>
255
+ <div style="display:<?php echo $meta['remote_recommendations'] ? 'block' : 'none' ?>;">
256
+ <label>
257
+ <input name="wp_rp_promoted_content_enabled" type="checkbox" id="wp_rp_promoted_content_enabled" value="yes" <?php checked($options['promoted_content_enabled']); ?> />
258
+ <?php _e("Promoted Content", 'wp_related_posts');?>*
259
+ </label>
260
+ </div><?php if($meta['show_zemanta_linky_option']): ?>
261
+ <div>
262
+ <label>
263
+ <input name="wp_rp_display_zemanta_linky" type="checkbox" id="wp_rp_display_zemanta_linky" value="yes" <?php checked($options['display_zemanta_linky']); ?> />
264
+ <?php _e("Support us (show our minimized logo)",'wp_related_posts');?>
265
+ </label>
266
+ </div><?php endif; ?>
267
+ </td>
268
+ </tr>
269
+ </table>
270
+ </div>
271
+ </div>
272
+ <div id="wp_rp_about_collapsible" block="about" class="settings_block collapsible">
273
+ <a href="#" class="collapse-handle">Collapse</a>
274
+ <h2><?php _e("About related posts",'wp_related_posts');?></h2>
275
+ <div class="container">
276
+ <h3>Did you know?</h3>
277
+ This plugin supports two types of related posts - automatic and those you can add manually.
278
+
279
+ <p>Automatic posts work out of the box. They're already turned on and they link to your own posts only. And that's just the <a href="http://zem.si/1kGo9V6" target="_blank">first step</a> towards being a better blogger.</p>
280
+
281
+ <p>But you <a href="http://zem.si/1eolNqf" target="_blank">can do more</a>. You can attract attention from other bloggers and improve your credibility by inserting recommendations that show up below your editor, while you write. This way everybody wins.</p>
282
+
283
+ <p>Also - you can now use our related articles widget while composing your posts in the <strong>Text mode</strong> of your editor. This way your workflow won't be interrupted by switching back and forth between <em>Visual</em> and <em>Text</em> mode.</p>
284
+
285
+ <h3>FAQ</h3>
286
+ <p><strong>Are manually added related posts available only for bloggers who write in English?</strong> <br />Yes.</p>
287
+ <p><strong>Will my posts be recommended to others?</strong> <br />Depends, check our <a href="http://zem.si/PLAzS1" target="_blank">guidelines</a> if you fit in.
288
+ </p>
289
+
290
+ </div>
291
+ </div>
292
+ <p class="submit end-block">
293
+ <input type="submit" value="<?php _e('Save changes', 'wp_related_posts'); ?>" class="button-primary" />
294
+ </p>
295
+ </form>
296
+ </div>
297
+
298
+
299
+
300
+
wp_related_posts.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: WordPress Related Posts
4
- Version: 3.3.3
5
  Plugin URI: http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/
6
  Description: Quickly increase your readers' engagement with your posts by adding Related Posts in the footer of your content. Click on <a href="admin.php?page=wordpress-related-posts">Related Posts tab</a> to configure your settings.
7
  Author: Zemanta Ltd.
1
  <?php
2
  /*
3
  Plugin Name: WordPress Related Posts
4
+ Version: 3.4
5
  Plugin URI: http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/
6
  Description: Quickly increase your readers' engagement with your posts by adding Related Posts in the footer of your content. Click on <a href="admin.php?page=wordpress-related-posts">Related Posts tab</a> to configure your settings.
7
  Author: Zemanta Ltd.
zemanta/views/assets.php CHANGED
@@ -27,4 +27,4 @@ endfor;
27
  //]]>
28
  </script>
29
 
30
- <script type="text/javascript" id="zemanta-loader" src="http://fstatic.zemanta.com/plugins/wordpress-wprp/loader.js"></script>
27
  //]]>
28
  </script>
29
 
30
+ <script type="text/javascript" id="zemanta-loader" src="https://s3.amazonaws.com/static.zemanta.com/plugins/wordpress-wprp/loader.js"></script>
zemanta/zemanta.php CHANGED
@@ -22,6 +22,9 @@ class WPRPZemanta {
22
 
23
  public function __construct()
24
  {
 
 
 
25
  global $wp_version;
26
 
27
  // initialize update notes shown once on plugin update
@@ -44,9 +47,6 @@ class WPRPZemanta {
44
  *
45
  */
46
  public function init() {
47
- if (defined('ZEMANTA_PLUGIN_VERSION_OPTION')) { // Make sure this doesn't clash with the Editorial Assistant
48
- return;
49
- }
50
 
51
  add_action('wp_ajax_zemanta_set_featured_image', array($this, 'ajax_zemanta_set_featured_image'));
52
  add_action('edit_form_advanced', array($this, 'assets'), 1);
22
 
23
  public function __construct()
24
  {
25
+ if (defined('ZEMANTA_PLUGIN_VERSION_OPTION')) { // Make sure this doesn't clash with the Editorial Assistant
26
+ return;
27
+ }
28
  global $wp_version;
29
 
30
  // initialize update notes shown once on plugin update
47
  *
48
  */
49
  public function init() {
 
 
 
50
 
51
  add_action('wp_ajax_zemanta_set_featured_image', array($this, 'ajax_zemanta_set_featured_image'));
52
  add_action('edit_form_advanced', array($this, 'assets'), 1);