Yet Another Related Posts Plugin (YARPP) - Version 4.0.4b5

Version Description

Download this release

Release Info

Developer mitchoyoshitaka
Plugin Icon 128x128 Yet Another Related Posts Plugin (YARPP)
Version 4.0.4b5
Comparing to
See all releases

Code changes from version 4.0.4b4 to 4.0.4b5

Files changed (3) hide show
  1. class-admin.php +22 -8
  2. class-core.php +3 -1
  3. yarpp.php +2 -2
class-admin.php CHANGED
@@ -51,16 +51,20 @@ class YARPP_Admin {
51
  function ui_register() {
52
  global $wp_version;
53
  if ( get_option( 'yarpp_activated' ) ) {
54
- if ( version_compare($wp_version, '3.3b1', '>=') ) {
55
- delete_option( 'yarpp_activated' );
56
- add_action( 'admin_enqueue_scripts', array( $this, 'pointer_enqueue' ) );
57
- add_action( 'admin_print_footer_scripts', array( $this, 'pointer_script' ) );
58
- }
59
  } elseif ( !$this->core->get_option('optin') &&
60
  current_user_can('manage_options') &&
61
  !get_user_option( 'yarpp_saw_optin' )
62
  ) {
63
  add_action( 'admin_notices', array( $this, 'optin_notice' ) );
 
 
 
 
 
64
  }
65
 
66
  // setup admin
@@ -176,15 +180,21 @@ class YARPP_Admin {
176
  </script>\n";
177
  }
178
 
179
- function optin_notice() {
180
  $screen = get_current_screen();
181
  if ( is_null($screen) || $screen->id == 'settings_page_yarpp' )
182
  return;
183
 
184
- $user = get_current_user_id();
185
- update_user_option( $user, 'yarpp_saw_optin', true );
 
 
 
 
186
 
187
  echo '<div class="updated fade"><p>';
 
 
188
  _e( "<strong>Help make YARPP better</strong> by sending information about YARPP's settings and usage statistics.", 'yarpp' );
189
 
190
  echo '</p><p>';
@@ -192,6 +202,10 @@ class YARPP_Admin {
192
  echo '<a class="button" href="options-general.php?page=yarpp#help-optin">' . __( 'Learn More', 'yarpp' ) . '</a>';
193
  echo '</p></div>';
194
  }
 
 
 
 
195
 
196
  // faux-markdown, required for the help text rendering
197
  protected function markdown( $text ) {
51
  function ui_register() {
52
  global $wp_version;
53
  if ( get_option( 'yarpp_activated' ) ) {
54
+ delete_option( 'yarpp_activated' );
55
+ delete_option( 'yarpp_upgraded' );
56
+ add_action( 'admin_enqueue_scripts', array( $this, 'pointer_enqueue' ) );
57
+ add_action( 'admin_print_footer_scripts', array( $this, 'pointer_script' ) );
 
58
  } elseif ( !$this->core->get_option('optin') &&
59
  current_user_can('manage_options') &&
60
  !get_user_option( 'yarpp_saw_optin' )
61
  ) {
62
  add_action( 'admin_notices', array( $this, 'optin_notice' ) );
63
+ } elseif ( !$this->core->get_option('optin') &&
64
+ current_user_can('manage_options') &&
65
+ get_option( 'yarpp_upgraded' )
66
+ ) {
67
+ add_action( 'admin_notices', array( $this, 'upgrade_notice' ) );
68
  }
69
 
70
  // setup admin
180
  </script>\n";
181
  }
182
 
183
+ function optin_notice( $upgrade = false ) {
184
  $screen = get_current_screen();
185
  if ( is_null($screen) || $screen->id == 'settings_page_yarpp' )
186
  return;
187
 
188
+ if ( $upgrade ) {
189
+ delete_option( 'yarpp_upgraded' );
190
+ } else {
191
+ $user = get_current_user_id();
192
+ update_user_option( $user, 'yarpp_saw_optin', true );
193
+ }
194
 
195
  echo '<div class="updated fade"><p>';
196
+ if ( $upgrade )
197
+ echo '<strong>' . sprintf( __('%1$s updated successfully.'), 'Yet Another Related Posts Plugin' ) . '</strong> ';
198
  _e( "<strong>Help make YARPP better</strong> by sending information about YARPP's settings and usage statistics.", 'yarpp' );
199
 
200
  echo '</p><p>';
202
  echo '<a class="button" href="options-general.php?page=yarpp#help-optin">' . __( 'Learn More', 'yarpp' ) . '</a>';
203
  echo '</p></div>';
204
  }
205
+
206
+ function upgrade_notice() {
207
+ $this->optin_notice( true );
208
+ }
209
 
210
  // faux-markdown, required for the help text rendering
211
  protected function markdown( $text ) {
class-core.php CHANGED
@@ -61,6 +61,7 @@ class YARPP {
61
  if ( is_admin() ) {
62
  require_once(YARPP_DIR . '/class-admin.php');
63
  $this->admin = new YARPP_Admin( $this );
 
64
  }
65
  }
66
 
@@ -431,7 +432,8 @@ class YARPP {
431
 
432
  $this->version_info(true);
433
 
434
- update_option('yarpp_version',YARPP_VERSION);
 
435
  $this->delete_transient( 'yarpp_optin' );
436
  }
437
 
61
  if ( is_admin() ) {
62
  require_once(YARPP_DIR . '/class-admin.php');
63
  $this->admin = new YARPP_Admin( $this );
64
+ $this->enforce();
65
  }
66
  }
67
 
432
 
433
  $this->version_info(true);
434
 
435
+ update_option( 'yarpp_version', YARPP_VERSION );
436
+ update_option( 'yarpp_upgraded', true );
437
  $this->delete_transient( 'yarpp_optin' );
438
  }
439
 
yarpp.php CHANGED
@@ -3,13 +3,13 @@
3
  Plugin Name: Yet Another Related Posts Plugin
4
  Plugin URI: http://yarpp.org/
5
  Description: Returns a list of related entries based on a unique algorithm for display on your blog and RSS feeds. Now with Now with thumbnail support built-in!
6
- Version: 4.0.4b4
7
  Author: mitcho (Michael Yoshitaka Erlewine)
8
  Author URI: http://mitcho.com/
9
  Donate link: http://tinyurl.com/donatetomitcho
10
  */
11
 
12
- define('YARPP_VERSION', '4.0.4b4');
13
  define('YARPP_DIR', dirname(__FILE__));
14
  define('YARPP_NO_RELATED', ':(');
15
  define('YARPP_RELATED', ':)');
3
  Plugin Name: Yet Another Related Posts Plugin
4
  Plugin URI: http://yarpp.org/
5
  Description: Returns a list of related entries based on a unique algorithm for display on your blog and RSS feeds. Now with Now with thumbnail support built-in!
6
+ Version: 4.0.4b5
7
  Author: mitcho (Michael Yoshitaka Erlewine)
8
  Author URI: http://mitcho.com/
9
  Donate link: http://tinyurl.com/donatetomitcho
10
  */
11
 
12
+ define('YARPP_VERSION', '4.0.4b5');
13
  define('YARPP_DIR', dirname(__FILE__));
14
  define('YARPP_NO_RELATED', ':(');
15
  define('YARPP_RELATED', ':)');