WordPress Related Posts - Version 3.4.3

Version Description

  • Updated HTTPS urls
  • Changed registration process
Download this release

Release Info

Developer ddksr
Plugin Icon wp plugin WordPress Related Posts
Version 3.4.3
Comparing to
See all releases

Code changes from version 3.4.2 to 3.4.3

Files changed (6) hide show
  1. config.php +16 -3
  2. init.php +1 -1
  3. readme.txt +5 -1
  4. settings.php +59 -0
  5. wp_related_posts.php +1 -1
  6. zemanta/views/assets.php +1 -1
config.php CHANGED
@@ -1,9 +1,9 @@
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 {
@@ -200,6 +200,9 @@ function wp_rp_install() {
200
  'show_turn_on_button' => true,
201
  'name' => '',
202
  'email' => '',
 
 
 
203
  'remote_notifications' => array(),
204
  'global_notice' => null,
205
  'turn_on_button_pressed' => false,
@@ -254,6 +257,16 @@ function wp_rp_is_classic() {
254
  return false;
255
  }
256
 
 
 
 
 
 
 
 
 
 
 
257
  function wp_rp_migrate_3_4_1() {
258
  $wp_rp_meta = get_option('wp_rp_meta');
259
  $wp_rp_meta['version'] = '3.4.2';
1
  <?php
2
+ define('WP_RP_STATIC_BASE_URL', 'https://wprp.zemanta.com/static/');
3
+ define("WP_RP_ZEMANTA_API_URL", "http://api.zemanta.com/services/rest/0.0/");
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://wprp.zemanta.com/static/');
7
 
8
  define("WP_RP_DEFAULT_CUSTOM_CSS",
9
  ".related_post_title {
200
  'show_turn_on_button' => true,
201
  'name' => '',
202
  'email' => '',
203
+ 'subscribed' => false,
204
+ 'registered' => false,
205
+ 'zemanta_api_key' => false,
206
  'remote_notifications' => array(),
207
  'global_notice' => null,
208
  'turn_on_button_pressed' => false,
257
  return false;
258
  }
259
 
260
+ function wp_rp_migrate_3_4_2() {
261
+ $wp_rp_meta = get_option('wp_rp_meta');
262
+ $wp_rp_meta['version'] = '3.4.3';
263
+ $wp_rp_meta['new_user'] = false;
264
+ $wp_rp_meta['subscribed'] = false;
265
+ $wp_rp_meta['registered'] = false;
266
+ $wp_rp_meta['zemanta_api_key'] = false;
267
+ update_option('wp_rp_meta', $wp_rp_meta);
268
+ }
269
+
270
  function wp_rp_migrate_3_4_1() {
271
  $wp_rp_meta = get_option('wp_rp_meta');
272
  $wp_rp_meta['version'] = '3.4.2';
init.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- define('WP_RP_VERSION', '3.4.2');
3
 
4
  define('WP_RP_PLUGIN_FILE', plugin_basename(__FILE__));
5
 
1
  <?php
2
+ define('WP_RP_VERSION', '3.4.3');
3
 
4
  define('WP_RP_PLUGIN_FILE', plugin_basename(__FILE__));
5
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.2
8
 
9
  WordPress Related Posts generates a list of related posts with thumbnails and gives you click-through statistics.
10
 
@@ -90,6 +90,10 @@ Fix for security vulnerability. Upgrade immediately.
90
 
91
  == Changelog ==
92
 
 
 
 
 
93
  = 3.4.2 =
94
  * Responsive themes bug fix
95
  * Better related post summary shortening
4
  License: GPLv2
5
  Requires at least: 3.3
6
  Tested up to: 3.9
7
+ Stable tag: 3.4.3
8
 
9
  WordPress Related Posts generates a list of related posts with thumbnails and gives you click-through statistics.
10
 
90
 
91
  == Changelog ==
92
 
93
+ = 3.4.3 =
94
+ * Updated HTTPS urls
95
+ * Changed registration process
96
+
97
  = 3.4.2 =
98
  * Responsive themes bug fix
99
  * Better related post summary shortening
settings.php CHANGED
@@ -165,11 +165,70 @@ function wp_rp_ajax_hide_show_statistics() {
165
 
166
  add_action('wp_ajax_rp_show_hide_statistics', 'wp_rp_ajax_hide_show_statistics');
167
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  function wp_rp_settings_page() {
169
  if (!current_user_can('delete_users')) {
170
  die('Sorry, you don\'t have permissions to access this page.');
171
  }
172
 
 
 
173
  $options = wp_rp_get_options();
174
  $meta = wp_rp_get_meta();
175
 
165
 
166
  add_action('wp_ajax_rp_show_hide_statistics', 'wp_rp_ajax_hide_show_statistics');
167
 
168
+ function wp_rp_get_api_key() {
169
+ $meta = wp_rp_get_meta();
170
+ if($meta['zemanta_api_key']) return $meta['zemanta_api_key'];
171
+
172
+ $zemanta_options = get_option('zemanta_options');
173
+ if ($zemanta_options && !empty($zemanta_options['api_key'])) {
174
+ $meta['zemanta_api_key'] = $zemanta_options['api_key'];
175
+ wp_rp_update_meta($meta);
176
+ return $meta['zemanta_api_key'];
177
+ }
178
+ return false;
179
+ }
180
+
181
+ function wp_rp_register() {
182
+ $meta = wp_rp_get_meta();
183
+ if ($meta['registered']) {
184
+ return;
185
+ }
186
+ $api_key = wp_rp_get_api_key();
187
+ if(! $api_key) {
188
+ $wprp_zemanta = new WPRPZemanta();
189
+ $wprp_zemanta->init(); // we have to do this manually because the admin_init hook was already triggered
190
+ $wprp_zemanta->register_options();
191
+
192
+ $api_key = $wprp_zemanta->api_key;
193
+ $meta['zemanta_api_key'] = $api_key;
194
+ }
195
+ if (!$api_key) { return false; }
196
+
197
+ $url = urlencode(get_bloginfo('wpurl'));
198
+ $post = array(
199
+ 'api_key' => $api_key,
200
+ 'platform' => 'wordpress-wprp',
201
+ 'post_rid' => '',
202
+ 'post_url' => $url,
203
+ 'current_url' => $url,
204
+ 'format' => 'json',
205
+ 'method' => 'zemanta.post_published_ping'
206
+ );
207
+ $response = wp_remote_post(WP_RP_ZEMANTA_API_URL, array(
208
+ 'body' => $post,
209
+ 'timeout' => 30
210
+ ));
211
+ if (wp_remote_retrieve_response_code($response) == 200) {
212
+ $body = wp_remote_retrieve_body($response);
213
+ if ($body) {
214
+ $response_json = json_decode($body);
215
+ $meta['registered'] = $response_json->status === 'ok';
216
+ }
217
+ }
218
+
219
+ wp_rp_update_meta($meta);
220
+ return $meta['registered'];
221
+ }
222
+
223
+
224
+
225
  function wp_rp_settings_page() {
226
  if (!current_user_can('delete_users')) {
227
  die('Sorry, you don\'t have permissions to access this page.');
228
  }
229
 
230
+ wp_rp_register();
231
+
232
  $options = wp_rp_get_options();
233
  $meta = wp_rp_get_meta();
234
 
wp_related_posts.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: WordPress Related Posts
4
- Version: 3.4.2
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.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.
zemanta/views/assets.php CHANGED
@@ -27,4 +27,4 @@ endfor;
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>
27
  //]]>
28
  </script>
29
 
30
+ <script type="text/javascript" id="zemanta-loader" src="https://static.zemanta.com/plugins/wordpress-wprp/loader.js"></script>