Commit 3e914baa authored by Erick Hitter's avatar Erick Hitter

Allow users to rename the metabox for clarity

parent e51eb61d
......@@ -53,7 +53,7 @@ class external_permalinks_redux {
*/
function __construct() {
add_action( 'init', array( $this, 'action_init' ), 0 ); // other init actions may rely on permalinks so filter early
add_action( 'admin_init', array( $this, 'action_admin_init' ) );
add_action( 'add_meta_boxes', array( $this, 'action_add_meta_boxes' ) );
add_action( 'save_post', array( $this, 'action_save_post' ) );
add_filter( 'post_link', array( $this, 'filter_post_permalink' ), 1, 2 );
......@@ -84,18 +84,26 @@ class external_permalinks_redux {
* Add meta box
*
* @uses apply_filters
* @uses __
* @uses add_meta_box
* @action admin_init
* @action add_meta_boxes
* @return null
*/
function action_admin_init() {
function action_add_meta_boxes() {
$post_types = apply_filters( 'epr_post_types', array( 'post', 'page' ) );
if ( ! is_array( $post_types ) )
return;
foreach( $post_types as $post_type ) {
add_meta_box( 'external-permalinks-redux', __( 'External Permalinks Redux', 'external-permalinks-redux' ), array( $this, 'meta_box' ), $post_type, 'normal' );
$title = apply_filters( 'epr_metabox_title', '', $post_type );
if ( ! $title )
$title = __( 'External Permalinks Redux', 'external-permalinks-redux' );
add_meta_box( 'external-permalinks-redux', $title, array( $this, 'meta_box' ), $post_type, 'normal' );
unset( $title );
}
}
......@@ -228,6 +236,18 @@ class external_permalinks_redux {
exit;
}
}
/**
** BACKWARDS COMPATIBILITY
** FUNCTIONS FOUNDS BELOW ARE DEPRECATED
**/
/**
* Action changed and function renamed in v1.1.
*/
public function action_admin_init() {
$this->action_add_meta_boxes();
}
}
// Initialize the plugin if it hasn't already
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment