Yet Another Related Posts Plugin (YARPP) - Version 3.5.4b3

Version Description

Download this release

Release Info

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

Code changes from version 3.5.4b2 to 3.5.4b3

Files changed (4) hide show
  1. class-admin.php +12 -7
  2. options.php +2 -0
  3. readme.txt +2 -1
  4. yarpp.php +2 -2
class-admin.php CHANGED
@@ -15,8 +15,9 @@ class YARPP_Admin {
15
  exit;
16
  }
17
 
18
- add_action( 'admin_init', array($this, 'ajax_register') );
19
  add_action( 'admin_menu', array( $this, 'ui_register' ) );
 
20
  // new in 3.3: set default meta boxes to show:
21
  add_filter( 'default_hidden_meta_boxes', array( $this, 'default_hidden_meta_boxes' ), 10, 2 );
22
  }
@@ -53,9 +54,7 @@ class YARPP_Admin {
53
 
54
  // setup admin
55
  $this->hook = add_options_page(__('Related Posts (YARPP)','yarpp'),__('Related Posts (YARPP)','yarpp'), 'manage_options', 'yarpp', array( $this, 'options_page' ) );
56
- // new in 3.3: load options page sections as metaboxes
57
- require_once('options-meta-boxes.php');
58
-
59
  // new in 3.0.12: add settings link to the plugins page
60
  add_filter('plugin_action_links', array( $this, 'settings_link' ), 10, 2);
61
 
@@ -65,17 +64,23 @@ class YARPP_Admin {
65
  // new in 3.3: properly enqueue scripts for admin:
66
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
67
  }
 
 
 
 
 
 
68
 
69
  // since 3.3
70
  function enqueue() {
71
- global $current_screen;
72
  $version = defined('WP_DEBUG') && WP_DEBUG ? time() : YARPP_VERSION;
73
- if (is_object($current_screen) && $current_screen->id == 'settings_page_yarpp') {
 
74
  wp_enqueue_script( 'postbox' );
75
  wp_enqueue_style( 'yarpp_options', plugins_url( 'options.css', __FILE__ ), array(), $version );
76
  wp_enqueue_script( 'yarpp_options', plugins_url( 'js/options.js', __FILE__ ), array('jquery'), $version );
77
  }
78
- if (is_object($current_screen) && $current_screen->id == 'post') {
79
  wp_enqueue_script( 'yarpp_metabox', plugins_url( 'js/metabox.js', __FILE__ ), array('jquery'), $version );
80
  }
81
  }
15
  exit;
16
  }
17
 
18
+ add_action( 'admin_init', array( $this, 'ajax_register' ) );
19
  add_action( 'admin_menu', array( $this, 'ui_register' ) );
20
+ add_action( 'yarpp_settings_page', array( $this, 'load_meta_boxes' ) );
21
  // new in 3.3: set default meta boxes to show:
22
  add_filter( 'default_hidden_meta_boxes', array( $this, 'default_hidden_meta_boxes' ), 10, 2 );
23
  }
54
 
55
  // setup admin
56
  $this->hook = add_options_page(__('Related Posts (YARPP)','yarpp'),__('Related Posts (YARPP)','yarpp'), 'manage_options', 'yarpp', array( $this, 'options_page' ) );
57
+
 
 
58
  // new in 3.0.12: add settings link to the plugins page
59
  add_filter('plugin_action_links', array( $this, 'settings_link' ), 10, 2);
60
 
64
  // new in 3.3: properly enqueue scripts for admin:
65
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
66
  }
67
+
68
+ // 3.5.4: only load metabox code if we're going to be on the settings page
69
+ function load_meta_boxes() {
70
+ // new in 3.3: load options page sections as metaboxes
71
+ require_once('options-meta-boxes.php');
72
+ }
73
 
74
  // since 3.3
75
  function enqueue() {
 
76
  $version = defined('WP_DEBUG') && WP_DEBUG ? time() : YARPP_VERSION;
77
+ $screen = get_current_screen();
78
+ if ( !is_null($screen) && $screen->id == 'settings_page_yarpp' ) {
79
  wp_enqueue_script( 'postbox' );
80
  wp_enqueue_style( 'yarpp_options', plugins_url( 'options.css', __FILE__ ), array(), $version );
81
  wp_enqueue_script( 'yarpp_options', plugins_url( 'js/options.js', __FILE__ ), array('jquery'), $version );
82
  }
83
+ if ( !is_null($screen) && $screen->id == 'post' ) {
84
  wp_enqueue_script( 'yarpp_metabox', plugins_url( 'js/metabox.js', __FILE__ ), array('jquery'), $version );
85
  }
86
  }
options.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
  global $wpdb, $wp_version, $yarpp;
3
 
 
 
4
  // Enforce YARPP setup:
5
  $yarpp->enforce();
6
 
1
  <?php
2
  global $wpdb, $wp_version, $yarpp;
3
 
4
+ do_action( 'yarpp_settings_page' );
5
+
6
  // Enforce YARPP setup:
7
  $yarpp->enforce();
8
 
readme.txt CHANGED
@@ -241,7 +241,8 @@ If you are a bilingual speaker of English and another language and an avid user
241
 
242
  * Retina icons! Now served faster, in sprite form.
243
  * Bugfix: stopwords would not be loaded if WPLANG is defined but blank.
244
- * Add new `stats` method to `YARPP_Cache_*` objects.
 
245
 
246
  = 3.5.3 =
247
 
241
 
242
  * Retina icons! Now served faster, in sprite form.
243
  * Bugfix: stopwords would not be loaded if WPLANG is defined but blank.
244
+ * Added new `stats` method to `YARPP_Cache_*` objects.
245
+ * Added `yarpp_settings_page` action to the options page and use it to load meta box code.
246
 
247
  = 3.5.3 =
248
 
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 custom post type support!
6
- Version: 3.5.4b2
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', '3.5.4b2');
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 custom post type support!
6
+ Version: 3.5.4b3
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', '3.5.4b3');
13
  define('YARPP_DIR', dirname(__FILE__));
14
  define('YARPP_NO_RELATED', ':(');
15
  define('YARPP_RELATED', ':)');