Yet Another Related Posts Plugin (YARPP) - Version 4.2.1

Version Description

  • FIXBUG: YARPP Pro options not been updated on plugin upgrade.
Download this release

Release Info

Developer jeffparker
Plugin Icon 128x128 Yet Another Related Posts Plugin (YARPP)
Version 4.2.1
Comparing to
See all releases

Code changes from version 4.2 to 4.2.1

classes/YARPP_Admin.php CHANGED
@@ -6,20 +6,6 @@ class YARPP_Admin {
6
 
7
  function __construct(&$core) {
8
  $this->core = &$core;
9
-
10
- /* YARPP Pro Default Options */
11
- add_option(
12
- 'yarpp_pro',
13
- array(
14
- 'active' => '0',
15
- 'aid' => null,
16
- 'st' => null,
17
- 'v' => null,
18
- 'dpid' => null,
19
- 'optin' => false,
20
- 'auto_display_post_types' => array('post')
21
- )
22
- );
23
 
24
  /* If action = flush and the nonce is correct, reset the cache */
25
  if (isset($_GET['action']) && $_GET['action'] === 'flush' && check_ajax_referer('yarpp_cache_flush', false, false) !== false) {
6
 
7
  function __construct(&$core) {
8
  $this->core = &$core;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  /* If action = flush and the nonce is correct, reset the cache */
11
  if (isset($_GET['action']) && $_GET['action'] === 'flush' && check_ajax_referer('yarpp_cache_flush', false, false) !== false) {
classes/YARPP_Core.php CHANGED
@@ -11,6 +11,7 @@ class YARPP {
11
  * settings (yarpp_options.php) and other tasks.
12
  */
13
  public $default_options = array();
 
14
  public $default_hidden_metaboxes = array();
15
  public $debug = false;
16
  public $yarppPro = null;
@@ -29,9 +30,8 @@ class YARPP {
29
  );
30
 
31
  public function __construct() {
32
-
33
- $this->yarppPro = get_option('yarpp_pro');
34
  $this->load_default_options();
 
35
 
36
  /* Loads the plugin's translated strings. */
37
  load_plugin_textdomain('yarpp', false, plugin_basename(YARPP_DIR).'/lang');
@@ -88,6 +88,19 @@ class YARPP {
88
  /*
89
  * OPTIONS
90
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  private function load_default_options() {
92
  $this->default_options = array(
93
  'threshold' => 4,
@@ -203,6 +216,21 @@ class YARPP {
203
 
204
  return $current;
205
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
 
207
  private function array_flatten($array, $given = array()) {
208
  foreach ($array as $key => $val) {
@@ -226,7 +254,6 @@ class YARPP {
226
  } else {
227
  $this->upgrade();
228
  }
229
-
230
  if ($this->get_option('optin')) $this->optin_ping();
231
  }
232
 
@@ -237,7 +264,6 @@ class YARPP {
237
  }
238
 
239
  public function activate() {
240
-
241
  /*
242
  * If it's not known to be disabled, but the indexes aren't there.
243
  */
@@ -493,8 +519,8 @@ class YARPP {
493
 
494
  public function upgrade() {
495
  $last_version = get_option('yarpp_version');
 
496
  if (version_compare(YARPP_VERSION, $last_version) === 0) return;
497
-
498
  if ($last_version && version_compare('3.4b2', $last_version) > 0) $this->upgrade_3_4b2();
499
  if ($last_version && version_compare('3.4b5', $last_version) > 0) $this->upgrade_3_4b5();
500
  if ($last_version && version_compare('3.4b8', $last_version) > 0) $this->upgrade_3_4b8();
@@ -743,6 +769,12 @@ class YARPP {
743
  public function upgrade_4_0_1() {
744
  delete_transient('yarpp_version_info');
745
  }
 
 
 
 
 
 
746
 
747
  /*
748
  * UTILITIES
11
  * settings (yarpp_options.php) and other tasks.
12
  */
13
  public $default_options = array();
14
+ public $pro_default_options = array();
15
  public $default_hidden_metaboxes = array();
16
  public $debug = false;
17
  public $yarppPro = null;
30
  );
31
 
32
  public function __construct() {
 
 
33
  $this->load_default_options();
34
+ $this->yarppPro = $this->get_pro_options();
35
 
36
  /* Loads the plugin's translated strings. */
37
  load_plugin_textdomain('yarpp', false, plugin_basename(YARPP_DIR).'/lang');
88
  /*
89
  * OPTIONS
90
  */
91
+ private function load_pro_default_options() {
92
+ return
93
+ array(
94
+ 'active' => '0',
95
+ 'aid' => null,
96
+ 'st' => null,
97
+ 'v' => null,
98
+ 'dpid' => null,
99
+ 'optin' => false,
100
+ 'auto_display_post_types' => array('post')
101
+ );
102
+ }
103
+
104
  private function load_default_options() {
105
  $this->default_options = array(
106
  'threshold' => 4,
216
 
217
  return $current;
218
  }
219
+
220
+ private function get_pro_options(){
221
+ $current = get_option('yarpp_pro');
222
+ $defaults = $this->load_pro_default_options();
223
+
224
+ if ($current) {
225
+ $out = array_merge($defaults,$current);
226
+ update_option('yarpp_pro', $out);
227
+ } else {
228
+ $out = $defaults;
229
+ add_option('yarpp_pro',$out);
230
+ }
231
+
232
+ return $out;
233
+ }
234
 
235
  private function array_flatten($array, $given = array()) {
236
  foreach ($array as $key => $val) {
254
  } else {
255
  $this->upgrade();
256
  }
 
257
  if ($this->get_option('optin')) $this->optin_ping();
258
  }
259
 
264
  }
265
 
266
  public function activate() {
 
267
  /*
268
  * If it's not known to be disabled, but the indexes aren't there.
269
  */
519
 
520
  public function upgrade() {
521
  $last_version = get_option('yarpp_version');
522
+
523
  if (version_compare(YARPP_VERSION, $last_version) === 0) return;
 
524
  if ($last_version && version_compare('3.4b2', $last_version) > 0) $this->upgrade_3_4b2();
525
  if ($last_version && version_compare('3.4b5', $last_version) > 0) $this->upgrade_3_4b5();
526
  if ($last_version && version_compare('3.4b8', $last_version) > 0) $this->upgrade_3_4b8();
769
  public function upgrade_4_0_1() {
770
  delete_transient('yarpp_version_info');
771
  }
772
+
773
+ public function upgrade_4_2(){
774
+ $this->load_pro_default_options();
775
+ $new = array_merge($this->pro_default_options,$this->yarppPro);
776
+ update_option('yarpp_pro', $new);
777
+ }
778
 
779
  /*
780
  * UTILITIES
includes/init_functions.php CHANGED
@@ -10,7 +10,6 @@ function yarpp_plugin_activate($network_wide) {
10
  update_option('yarpp_activated', true);
11
  }
12
 
13
-
14
  function yarpp_set_option($options, $value = null) {
15
  global $yarpp;
16
  $yarpp->set_option($options, $value);
10
  update_option('yarpp_activated', true);
11
  }
12
 
 
13
  function yarpp_set_option($options, $value = null) {
14
  global $yarpp;
15
  $yarpp->set_option($options, $value);
readme.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://www.yarpp.com/
6
  Tags: feeds, pages, posts, related, rss, yarpp, ads, multisite, multilingual, thumbnails, related posts, related content
7
  Requires at least: 3.3
8
  Tested up to: 3.9.1
9
- Stable tag: 4.2
10
  License: GPLv2 or later
11
 
12
  Display a list of related posts on your site based on a powerful unique algorithm. Earn money by including sponsored content!
@@ -298,6 +298,9 @@ YARPP is currently localized in the following languages:
298
 
299
  == Changelog ==
300
 
 
 
 
301
  = 4.2 =
302
  * Tested on WordPress 3.9.
303
  * YARPP Basic and YARPP Pro can now be used simultaneously, rather than being mutually exclusive.
6
  Tags: feeds, pages, posts, related, rss, yarpp, ads, multisite, multilingual, thumbnails, related posts, related content
7
  Requires at least: 3.3
8
  Tested up to: 3.9.1
9
+ Stable tag: 4.2.1
10
  License: GPLv2 or later
11
 
12
  Display a list of related posts on your site based on a powerful unique algorithm. Earn money by including sponsored content!
298
 
299
  == Changelog ==
300
 
301
+ = 4.2.1 =
302
+ * FIXBUG: YARPP Pro options not been updated on plugin upgrade.
303
+
304
  = 4.2 =
305
  * Tested on WordPress 3.9.
306
  * YARPP Basic and YARPP Pro can now be used simultaneously, rather than being mutually exclusive.
yarpp.php CHANGED
@@ -2,7 +2,7 @@
2
  /*----------------------------------------------------------------------------------------------------------------------
3
  Plugin Name: Yet Another Related Posts Plugin
4
  Description: Adds related posts to your site and in RSS feeds, based on a powerful, customizable algorithm. Enabling YARPP Pro gives you access to even more powerful features. <a href="http://www.yarpp.com" target="_blank">Find out more</a>.
5
- Version: 4.2
6
  Author: Adknowledge
7
  Author URI: http://www.yarpp.com/
8
  Plugin URI: http://www.yarpp.com/
@@ -14,7 +14,7 @@ if(!defined('WP_CONTENT_DIR')){
14
  define('WP_CONTENT_DIR', substr($tr,0,strrpos($tr,'/')));
15
  }
16
 
17
- define('YARPP_VERSION', '4.2');
18
  define('YARPP_DIR', dirname(__FILE__));
19
  define('YARPP_URL', plugins_url('',__FILE__));
20
  define('YARPP_NO_RELATED', ':(');
2
  /*----------------------------------------------------------------------------------------------------------------------
3
  Plugin Name: Yet Another Related Posts Plugin
4
  Description: Adds related posts to your site and in RSS feeds, based on a powerful, customizable algorithm. Enabling YARPP Pro gives you access to even more powerful features. <a href="http://www.yarpp.com" target="_blank">Find out more</a>.
5
+ Version: 4.2.1
6
  Author: Adknowledge
7
  Author URI: http://www.yarpp.com/
8
  Plugin URI: http://www.yarpp.com/
14
  define('WP_CONTENT_DIR', substr($tr,0,strrpos($tr,'/')));
15
  }
16
 
17
+ define('YARPP_VERSION', '4.2.1');
18
  define('YARPP_DIR', dirname(__FILE__));
19
  define('YARPP_URL', plugins_url('',__FILE__));
20
  define('YARPP_NO_RELATED', ':(');