Code Duplication    Length = 18-18 lines in 2 locations

projects/plugins/vaultpress/vaultpress.php 2 locations

@@ 2997-3014 (lines=18) @@
2994
		add_filter( 'pre_update_option_active_plugins', array( $this, 'load_first' ) );
2995
	}
2996
2997
	function get_jetpack_email() {
2998
		if ( ! class_exists( 'Jetpack' ) ) {
2999
			return false;
3000
		}
3001
3002
		// For version of Jetpack prior to 7.7.
3003
		if ( defined( 'JETPACK__VERSION' ) && version_compare( JETPACK__VERSION, '7.7', '<' ) && ! class_exists( 'Jetpack_IXR_Client' ) ) {
3004
			Jetpack::load_xml_rpc_client();
3005
		}
3006
3007
		$xml = new Jetpack_IXR_Client( array( 'user_id' => get_current_user_id() ) );
3008
		$xml->query( 'wpcom.getUserEmail' );
3009
		if ( ! $xml->isError() ) {
3010
			return $xml->getResponse();
3011
		}
3012
3013
		return new WP_Error( $xml->getErrorCode(), $xml->getErrorMessage() );
3014
	}
3015
3016
	function get_key_via_jetpack( $already_purchased = false ) {
3017
		if ( ! class_exists( 'Jetpack' ) ) {
@@ 3016-3033 (lines=18) @@
3013
		return new WP_Error( $xml->getErrorCode(), $xml->getErrorMessage() );
3014
	}
3015
3016
	function get_key_via_jetpack( $already_purchased = false ) {
3017
		if ( ! class_exists( 'Jetpack' ) ) {
3018
			return false;
3019
		}
3020
3021
		// For version of Jetpack prior to 7.7.
3022
		if ( defined( 'JETPACK__VERSION' ) && version_compare( JETPACK__VERSION, '7.7', '<' ) && ! class_exists( 'Jetpack_IXR_Client' ) ) {
3023
			Jetpack::load_xml_rpc_client();
3024
		}
3025
3026
		$xml = new Jetpack_IXR_Client( array( 'user_id' => Jetpack_Options::get_option( 'master_user' ) ) );
3027
		$xml->query( 'vaultpress.registerSite', $already_purchased );
3028
		if ( ! $xml->isError() ) {
3029
			return $xml->getResponse();
3030
		}
3031
3032
		return new WP_Error( $xml->getErrorCode(), $xml->getErrorMessage() );
3033
	}
3034
3035
	function register_via_jetpack( $already_purchased = false ) {
3036
		$registration_key = $this->get_key_via_jetpack( $already_purchased );