Commit be80cda8 authored by Mohammad Jangda's avatar Mohammad Jangda

Convert to a traditional singleton approach.

parent 58df69de
......@@ -26,10 +26,18 @@ class external_permalinks_redux {
/*
* Class variables
*/
protected static $instance;
var $meta_key_target = '_links_to';
var $meta_key_type = '_links_to_type';
var $status_codes;
static function get_instance() {
if ( ! isset( self::$instance ) )
self::$instance = new external_permalinks_redux;
return self::$instance;
}
/*
* Register actions and filters
* @uses add_action, add_filter
......@@ -191,9 +199,9 @@ class external_permalinks_redux {
}
}
}
global $external_permalinks_redux;
if( !is_a( $external_permalinks_redux, 'external_permalinks_redux' ) )
$external_permalinks_redux = new external_permalinks_redux;
// Initialize the plugin if it hasn't already
external_permalinks_redux::get_instance();
/*
* Wrapper for meta box function
......@@ -203,10 +211,6 @@ if( !is_a( $external_permalinks_redux, 'external_permalinks_redux' ) )
* @return string
*/
function external_permalinks_redux_meta_box( $post ) {
global $external_permalinks_redux;
if( !is_a( $external_permalinks_redux, 'external_permalinks_redux' ) )
$external_permalinks_redux = new external_permalinks_redux;
$external_permalinks_redux->meta_box( $post );
external_permalinks_redux::get_instance()->meta_box( $post );
}
?>
\ No newline at end of file
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