Skip to content

Commit

Permalink
check to make sure function is not defined before using
Browse files Browse the repository at this point in the history
  • Loading branch information
matzko committed Jan 31, 2011
1 parent 0af27a8 commit ec65487
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions wp-json-rpc-api.php
Expand Up @@ -14,16 +14,18 @@

include_once ABSPATH . WPINC . '/class-IXR.php';

function load_wp_json_rpc_api()
{
global $wp_json_rpc_api;
if ( ! class_exists( 'WP_JSON_RPC_API_Control' ) ) {
require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'core.php';
}
if ( ! function_exists( 'load_wp_json_rpc_api' ) ) {
function load_wp_json_rpc_api()
{
global $wp_json_rpc_api;
if ( ! class_exists( 'WP_JSON_RPC_API_Control' ) ) {
require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'core.php';
}

if ( empty( $wp_json_rpc_api ) ) {
$wp_json_rpc_api = new WP_JSON_RPC_API_Control;
if ( empty( $wp_json_rpc_api ) ) {
$wp_json_rpc_api = new WP_JSON_RPC_API_Control;
}
}
}

add_action('plugins_loaded', 'load_wp_json_rpc_api');
add_action('plugins_loaded', 'load_wp_json_rpc_api');
}

0 comments on commit ec65487

Please sign in to comment.