<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[2470] sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-qbo/wordcamp-qbo.php: WordCamp QBO: Convert spaces to tabs for coding standards conformance.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/2470">2470</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/2470","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>iandunn</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-02-04 22:10:41 +0000 (Thu, 04 Feb 2016)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>WordCamp QBO: Convert spaces to tabs for coding standards conformance.

When adding new code that conforms to the guidelines, the existing spaces make it harder to review the diff, because they throw off the alignment of the addition and deletion lines.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcampqbowordcampqbophp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-qbo/wordcamp-qbo.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcampqbowordcampqbophp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-qbo/wordcamp-qbo.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-qbo/wordcamp-qbo.php     2016-02-04 21:34:15 UTC (rev 2469)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-qbo/wordcamp-qbo.php       2016-02-04 22:10:41 UTC (rev 2470)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,468 +4,470 @@
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> class WordCamp_QBO {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    private static $app_token;
-    private static $consumer_key;
-    private static $consumer_secret;
-    private static $hmac_key;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ private static $app_token;
+       private static $consumer_key;
+       private static $consumer_secret;
+       private static $hmac_key;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    private static $options;
-    private static $categories_map;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ private static $options;
+       private static $categories_map;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    public static function load_options() {
-        if ( isset( self::$options ) )
-            return self::$options;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function load_options() {
+               if ( isset( self::$options ) )
+                       return self::$options;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        self::$options = wp_parse_args( get_option( 'wordcamp-qbo', array() ), array(
-            'auth' => array(),
-        ) );
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         self::$options = wp_parse_args( get_option( 'wordcamp-qbo', array() ), array(
+                       'auth' => array(),
+               ) );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    /**
-     * Runs immediately.
-     */
-    public static function load() {
-        add_action( 'plugins_loaded', array( __CLASS__, 'plugins_loaded' ) );
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+        * Runs immediately.
+        */
+       public static function load() {
+               add_action( 'plugins_loaded', array( __CLASS__, 'plugins_loaded' ) );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    /**
-     * Runs during plugins_loaded.
-     */
-    public static function plugins_loaded() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+        * Runs during plugins_loaded.
+        */
+       public static function plugins_loaded() {
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $init_options = wp_parse_args( apply_filters( 'wordcamp_qbo_options', array() ), array(
-            'app_token' => '',
-            'consumer_key' => '',
-            'consumer_secret' => '',
-            'hmac_key' => '',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $init_options = wp_parse_args( apply_filters( 'wordcamp_qbo_options', array() ), array(
+                       'app_token' => '',
+                       'consumer_key' => '',
+                       'consumer_secret' => '',
+                       'hmac_key' => '',
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            'categories_map' => array(),
-        ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'categories_map' => array(),
+               ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        foreach ( $init_options as $key => $value )
-            self::$$key = $value;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         foreach ( $init_options as $key => $value )
+                       self::$$key = $value;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        // There's no point in doing anything if we don't have the secrets.
-        if ( empty( self::$consumer_key ) )
-            return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // There's no point in doing anything if we don't have the secrets.
+               if ( empty( self::$consumer_key ) )
+                       return;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        add_action( 'admin_menu', array( __CLASS__, 'admin_menu' ) );
-        add_action( 'admin_init', array( __CLASS__, 'admin_init' ) );
-        add_filter( 'rest_api_init', array( __CLASS__, 'rest_api_init' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         add_action( 'admin_menu', array( __CLASS__, 'admin_menu' ) );
+               add_action( 'admin_init', array( __CLASS__, 'admin_init' ) );
+               add_filter( 'rest_api_init', array( __CLASS__, 'rest_api_init' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        self::maybe_oauth_request();
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         self::maybe_oauth_request();
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    /**
-     * Runs during rest_api_init.
-     */
-    public static function rest_api_init() {
-        register_rest_route( 'wordcamp-qbo/v1', '/expense', array(
-            'methods' => 'GET, POST',
-            'callback' => array( __CLASS__, 'rest_callback_expense' ),
-        ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+        * Runs during rest_api_init.
+        */
+       public static function rest_api_init() {
+               register_rest_route( 'wordcamp-qbo/v1', '/expense', array(
+                       'methods' => 'GET, POST',
+                       'callback' => array( __CLASS__, 'rest_callback_expense' ),
+               ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        register_rest_route( 'wordcamp-qbo/v1', '/classes', array(
-            'methods' => 'GET',
-            'callback' => array( __CLASS__, 'rest_callback_classes' ),
-        ) );
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         register_rest_route( 'wordcamp-qbo/v1', '/classes', array(
+                       'methods' => 'GET',
+                       'callback' => array( __CLASS__, 'rest_callback_classes' ),
+               ) );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    /**
-     * REST: /expense
-     *
-     * @param WP_REST_Request $request
-     */
-    public static function rest_callback_expense( $request ) {
-        if ( ! self::_is_valid_request( $request ) )
-            return new WP_Error( 'unauthorized', 'Unauthorized', array( 'status' => 401 ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+        * REST: /expense
+        *
+        * @param WP_REST_Request $request
+        */
+       public static function rest_callback_expense( $request ) {
+               if ( ! self::_is_valid_request( $request ) )
+                       return new WP_Error( 'unauthorized', 'Unauthorized', array( 'status' => 401 ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        self::load_options();
-        $oauth = self::_get_oauth();
-        $oauth->set_token( self::$options['auth']['oauth_token'], self::$options['auth']['oauth_token_secret'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         self::load_options();
+               $oauth = self::_get_oauth();
+               $oauth->set_token( self::$options['auth']['oauth_token'], self::$options['auth']['oauth_token_secret'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $amount = floatval( $request->get_param( 'amount' ) );
-        if ( ! $amount )
-            return new WP_Error( 'error', 'An amount was not given.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $amount = floatval( $request->get_param( 'amount' ) );
+               if ( ! $amount )
+                       return new WP_Error( 'error', 'An amount was not given.' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $description = $request->get_param( 'description' );
-        if ( empty( $description ) )
-            return new WP_Error( 'error', 'The expense description can not be empty.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $description = $request->get_param( 'description' );
+               if ( empty( $description ) )
+                       return new WP_Error( 'error', 'The expense description can not be empty.' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $category = $request->get_param( 'category' );
-        if ( empty( $category ) || ! array_key_exists( $category, self::$categories_map ) )
-            return new WP_Error( 'error', 'The category you have picked is invalid.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $category = $request->get_param( 'category' );
+               if ( empty( $category ) || ! array_key_exists( $category, self::$categories_map ) )
+                       return new WP_Error( 'error', 'The category you have picked is invalid.' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $date = $request->get_param( 'date' );
-        if ( empty( $date ) )
-            return new WP_Error( 'error', 'The expense date can not be empty.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $date = $request->get_param( 'date' );
+               if ( empty( $date ) )
+                       return new WP_Error( 'error', 'The expense date can not be empty.' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $date = absint( $date );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $date = absint( $date );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $class = $request->get_param( 'class' );
-        if ( empty( $class ) )
-            return new WP_Error( 'error', 'You need to set a class.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $class = $request->get_param( 'class' );
+               if ( empty( $class ) )
+                       return new WP_Error( 'error', 'You need to set a class.' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $classes = self::_get_classes();
-        if ( ! array_key_exists( $class, $classes ) )
-            return new WP_Error( 'error', 'Unknown class.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $classes = self::_get_classes();
+               if ( ! array_key_exists( $class, $classes ) )
+                       return new WP_Error( 'error', 'Unknown class.' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $class = array(
-            'value' => $class,
-            'name' => $classes[ $class ],
-        );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $class = array(
+                       'value' => $class,
+                       'name' => $classes[ $class ],
+               );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $payload = array(
-            'AccountRef' => array(
-                'value' => '61',
-                'name' => 'Checking-JPM',
-            ),
-            'TxnDate' => gmdate( 'Y-m-d', $date ),
-            'PaymentType' => 'Cash',
-            'Line' => array(
-                array(
-                    'Id' => 1,
-                    'Description' => $description,
-                    'Amount' => $amount,
-                    'DetailType' => 'AccountBasedExpenseLineDetail',
-                    'AccountBasedExpenseLineDetail' => array(
-                        'ClassRef' => $class,
-                        'AccountRef' => self::$categories_map[ $category ],
-                    ),
-                ),
-            ),
-        );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $payload = array(
+                       'AccountRef' => array(
+                               'value' => '61',
+                               'name' => 'Checking-JPM',
+                       ),
+                       'TxnDate' => gmdate( 'Y-m-d', $date ),
+                       'PaymentType' => 'Cash',
+                       'Line' => array(
+                               array(
+                                       'Id' => 1,
+                                       'Description' => $description,
+                                       'Amount' => $amount,
+                                       'DetailType' => 'AccountBasedExpenseLineDetail',
+                                       'AccountBasedExpenseLineDetail' => array(
+                                               'ClassRef' => $class,
+                                               'AccountRef' => self::$categories_map[ $category ],
+                                       ),
+                               ),
+                       ),
+               );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( $request->get_param('id') ) {
-            $payload['Id'] = absint( $request->get_param('id') );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $request->get_param('id') ) {
+                       $payload['Id'] = absint( $request->get_param('id') );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            $request_url = esc_url_raw( sprintf( 'https://quickbooks.api.intuit.com/v3/company/%d/purchase/%d',
-                self::$options['auth']['realmId'], $payload['Id'] ) );
-            $oauth_header = $oauth->get_oauth_header( 'GET', $request_url );
-            $response = wp_remote_get( $request_url, array(
-                'headers' => array(
-                    'Authorization' => $oauth_header,
-                    'Accept' => 'application/json',
-                ),
-            ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $request_url = esc_url_raw( sprintf( 'https://quickbooks.api.intuit.com/v3/company/%d/purchase/%d',
+                               self::$options['auth']['realmId'], $payload['Id'] ) );
+                       $oauth_header = $oauth->get_oauth_header( 'GET', $request_url );
+                       $response = wp_remote_get( $request_url, array(
+                               'headers' => array(
+                                       'Authorization' => $oauth_header,
+                                       'Accept' => 'application/json',
+                               ),
+                       ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response != 200 ) )
-                return new WP_Error( 'error', 'Could not find purchase to update.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response != 200 ) )
+                               return new WP_Error( 'error', 'Could not find purchase to update.' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            $body = json_decode( wp_remote_retrieve_body( $response ), true );
-            if ( ! isset( $body['Purchase']['SyncToken'] ) )
-                return new WP_Error( 'error', 'Could not decode purchase for update.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $body = json_decode( wp_remote_retrieve_body( $response ), true );
+                       if ( ! isset( $body['Purchase']['SyncToken'] ) )
+                               return new WP_Error( 'error', 'Could not decode purchase for update.' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            $payload['SyncToken'] = $body['Purchase']['SyncToken'];
-            unset( $response );
-        }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $payload['SyncToken'] = $body['Purchase']['SyncToken'];
+                       unset( $response );
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $payload = json_encode( $payload );
-        $request_url = esc_url_raw( sprintf( 'https://quickbooks.api.intuit.com/v3/company/%d/purchase',
-            self::$options['auth']['realmId'] ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $payload = json_encode( $payload );
+               $request_url = esc_url_raw( sprintf( 'https://quickbooks.api.intuit.com/v3/company/%d/purchase',
+                       self::$options['auth']['realmId'] ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $oauth_header = $oauth->get_oauth_header( 'POST', $request_url, $payload );
-        $response = wp_remote_post( $request_url, array(
-            'headers' => array(
-                'Authorization' => $oauth_header,
-                'Accept' => 'application/json',
-                'Content-Type' => 'application/json',
-            ),
-            'body' => $payload,
-        ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $oauth_header = $oauth->get_oauth_header( 'POST', $request_url, $payload );
+               $response = wp_remote_post( $request_url, array(
+                       'headers' => array(
+                               'Authorization' => $oauth_header,
+                               'Accept' => 'application/json',
+                               'Content-Type' => 'application/json',
+                       ),
+                       'body' => $payload,
+               ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) != 200 )
-            return new WP_Error( 'error', 'Could not create purchase.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) != 200 )
+                       return new WP_Error( 'error', 'Could not create purchase.' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $body = json_decode( wp_remote_retrieve_body( $response ), true );
-        if ( empty( $body ) )
-            return new WP_Error( 'error', 'Could not decode create purchase result.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $body = json_decode( wp_remote_retrieve_body( $response ), true );
+               if ( empty( $body ) )
+                       return new WP_Error( 'error', 'Could not decode create purchase result.' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        return array(
-            'transaction_id' => intval( $body['Purchase']['Id'] ),
-        );
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return array(
+                       'transaction_id' => intval( $body['Purchase']['Id'] ),
+               );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    /**
-     * REST: /classes
-     *
-     * @param WP_REST_Request $request
-     */
-    public static function rest_callback_classes( $request ) {
-        if ( ! self::_is_valid_request( $request ) )
-            return new WP_Error( 'unauthorized', 'Unauthorized', array( 'status' => 401 ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+        * REST: /classes
+        *
+        * @param WP_REST_Request $request
+        */
+       public static function rest_callback_classes( $request ) {
+               if ( ! self::_is_valid_request( $request ) )
+                       return new WP_Error( 'unauthorized', 'Unauthorized', array( 'status' => 401 ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        return self::_get_classes();
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return self::_get_classes();
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    /**
-     * Get an array of available QBO classes.
-     *
-     * @uses get_transient, set_transient
-     *
-     * @return array An array of class IDs as keys, names as values.
-     */
-    private static function _get_classes() {
-        $cache_key = md5( 'wordcamp-qbo:classes' );
-        $cache = get_transient( $cache_key );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+        * Get an array of available QBO classes.
+        *
+        * @uses get_transient, set_transient
+        *
+        * @return array An array of class IDs as keys, names as values.
+        */
+       private static function _get_classes() {
+               $cache_key = md5( 'wordcamp-qbo:classes' );
+               $cache = get_transient( $cache_key );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( $cache !== false )
-            return $cache;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $cache !== false )
+                       return $cache;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        self::load_options();
-        $oauth = self::_get_oauth();
-        $oauth->set_token( self::$options['auth']['oauth_token'], self::$options['auth']['oauth_token_secret'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         self::load_options();
+               $oauth = self::_get_oauth();
+               $oauth->set_token( self::$options['auth']['oauth_token'], self::$options['auth']['oauth_token_secret'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $args = array(
-            'query' => 'SELECT * FROM Class',
-            'minorversion' => 4,
-        );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $args = array(
+                       'query' => 'SELECT * FROM Class',
+                       'minorversion' => 4,
+               );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $request_url = esc_url_raw( sprintf( 'https://quickbooks.api.intuit.com/v3/company/%d/query',
-            self::$options['auth']['realmId'] ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $request_url = esc_url_raw( sprintf( 'https://quickbooks.api.intuit.com/v3/company/%d/query',
+                       self::$options['auth']['realmId'] ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $oauth_header = $oauth->get_oauth_header( 'GET', $request_url, $args );
-        $response = wp_remote_get( esc_url_raw( add_query_arg( $args, $request_url ) ), array( 'headers' => array(
-            'Authorization' => $oauth_header,
-            'Accept' => 'application/json',
-        ) ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $oauth_header = $oauth->get_oauth_header( 'GET', $request_url, $args );
+               $response = wp_remote_get( esc_url_raw( add_query_arg( $args, $request_url ) ), array( 'headers' => array(
+                       'Authorization' => $oauth_header,
+                       'Accept' => 'application/json',
+               ) ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) !== 200 ) {
-            return new WP_Error( 'error', 'Could not fetch classes.' );
-        }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) !== 200 ) {
+                       return new WP_Error( 'error', 'Could not fetch classes.' );
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $body = json_decode( wp_remote_retrieve_body( $response ), true );
-        if ( empty( $body ) ) {
-            return new WP_Error( 'error', 'Could not fetch classes body.' );
-        }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $body = json_decode( wp_remote_retrieve_body( $response ), true );
+               if ( empty( $body ) ) {
+                       return new WP_Error( 'error', 'Could not fetch classes body.' );
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $classes = array();
-        foreach ( $body['QueryResponse']['Class'] as $class ) {
-            $classes[ $class['Id'] ] = $class['Name'];
-        }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $classes = array();
+               foreach ( $body['QueryResponse']['Class'] as $class ) {
+                       $classes[ $class['Id'] ] = $class['Name'];
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        asort( $classes );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         asort( $classes );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        set_transient( $cache_key, $classes, 12 * HOUR_IN_SECONDS );
-        return $classes;
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         set_transient( $cache_key, $classes, 12 * HOUR_IN_SECONDS );
+               return $classes;
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    /**
-     * Verify an HMAC signature for an API request.
-     *
-     * @param WP_REST_Request $request The REST API request.
-     *
-     * @return bool True if valid, false if invalid.
-     */
-    private static function _is_valid_request( $request ) {
-        if ( ! $request->get_header( 'authorization' ) )
-            return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+        * Verify an HMAC signature for an API request.
+        *
+        * @param WP_REST_Request $request The REST API request.
+        *
+        * @return bool True if valid, false if invalid.
+        */
+       private static function _is_valid_request( $request ) {
+               if ( ! $request->get_header( 'authorization' ) )
+                       return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( ! preg_match( '#^wordcamp-qbo-hmac (.+)$#', $request->get_header( 'authorization' ), $matches ) )
-            return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! preg_match( '#^wordcamp-qbo-hmac (.+)$#', $request->get_header( 'authorization' ), $matches ) )
+                       return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $given_hmac = $matches[1];
-        $request_url = esc_url_raw( home_url( parse_url( home_url( $_SERVER['REQUEST_URI'] ), PHP_URL_PATH ) ) );
-        $payload = json_encode( array( strtolower( $request->get_method() ), strtolower( $request_url ),
-            $request->get_body(), $request->get_query_params() ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $given_hmac = $matches[1];
+               $request_url = esc_url_raw( home_url( parse_url( home_url( $_SERVER['REQUEST_URI'] ), PHP_URL_PATH ) ) );
+               $payload = json_encode( array( strtolower( $request->get_method() ), strtolower( $request_url ),
+                       $request->get_body(), $request->get_query_params() ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        return hash_equals( hash_hmac( 'sha256', $payload, self::$hmac_key ), $given_hmac );
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return hash_equals( hash_hmac( 'sha256', $payload, self::$hmac_key ), $given_hmac );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    /**
-     * Update self::$options.
-     */
-    public static function update_options() {
-        self::load_options();
-        update_option( 'wordcamp-qbo', self::$options );
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+        * Update self::$options.
+        */
+       public static function update_options() {
+               self::load_options();
+               update_option( 'wordcamp-qbo', self::$options );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    /**
-     * Catch an OAuth authentication flow if it is one.
-     */
-    public static function maybe_oauth_request() {
-        if ( empty( $_GET['wordcamp-qbo-oauth-request'] ) )
-            return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+        * Catch an OAuth authentication flow if it is one.
+        */
+       public static function maybe_oauth_request() {
+               if ( empty( $_GET['wordcamp-qbo-oauth-request'] ) )
+                       return;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( empty( $_GET['wordcamp-qbo-oauth-nonce'] ) || ! wp_verify_nonce( $_GET['wordcamp-qbo-oauth-nonce'], 'oauth-request' ) )
-            wp_die( 'Could not verify nonce.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( empty( $_GET['wordcamp-qbo-oauth-nonce'] ) || ! wp_verify_nonce( $_GET['wordcamp-qbo-oauth-nonce'], 'oauth-request' ) )
+                       wp_die( 'Could not verify nonce.' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        self::load_options();
-        $oauth = self::_get_oauth();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         self::load_options();
+               $oauth = self::_get_oauth();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( empty( $_GET['oauth_token'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( empty( $_GET['oauth_token'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            // We don't have an access token yet.
-            $request_url = 'https://oauth.intuit.com/oauth/v1/get_request_token';
-            $callback_url = esc_url_raw( add_query_arg( array(
-                'wordcamp-qbo-oauth-request' => 1,
-                'wordcamp-qbo-oauth-nonce' => wp_create_nonce( 'oauth-request' ),
-            ), admin_url() ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 // We don't have an access token yet.
+                       $request_url = 'https://oauth.intuit.com/oauth/v1/get_request_token';
+                       $callback_url = esc_url_raw( add_query_arg( array(
+                               'wordcamp-qbo-oauth-request' => 1,
+                               'wordcamp-qbo-oauth-nonce' => wp_create_nonce( 'oauth-request' ),
+                       ), admin_url() ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            $request_token = $oauth->get_request_token( $request_url, $callback_url );
-            if ( is_wp_error( $request_token ) )
-                wp_die( $request_token->get_error_message() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $request_token = $oauth->get_request_token( $request_url, $callback_url );
+                       if ( is_wp_error( $request_token ) )
+                               wp_die( $request_token->get_error_message() );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            update_user_meta( get_current_user_id(), 'wordcamp-qbo-oauth', $request_token );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 update_user_meta( get_current_user_id(), 'wordcamp-qbo-oauth', $request_token );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            wp_redirect( esc_url_raw( add_query_arg( 'oauth_token', $request_token['oauth_token'],
-                'https://appcenter.intuit.com/Connect/Begin' ) ) );
-            die();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 wp_redirect( esc_url_raw( add_query_arg( 'oauth_token', $request_token['oauth_token'],
+                               'https://appcenter.intuit.com/Connect/Begin' ) ) );
+                       die();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        } else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         } else {
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            // We have a token.
-            $request_token = get_user_meta( get_current_user_id(), 'wordcamp-qbo-oauth', true );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 // We have a token.
+                       $request_token = get_user_meta( get_current_user_id(), 'wordcamp-qbo-oauth', true );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            if ( $request_token['oauth_token'] != $_GET['oauth_token'] )
-                wp_die( 'Could not verify OAuth token.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( $request_token['oauth_token'] != $_GET['oauth_token'] )
+                               wp_die( 'Could not verify OAuth token.' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            if ( empty( $_GET['oauth_verifier'] ) )
-                wp_die( 'Could not obtain OAuth verifier.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( empty( $_GET['oauth_verifier'] ) )
+                               wp_die( 'Could not obtain OAuth verifier.' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            $oauth->set_token( $request_token['oauth_token'], $request_token['oauth_token_secret'] );
-            $request_url = 'https://oauth.intuit.com/oauth/v1/get_access_token';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $oauth->set_token( $request_token['oauth_token'], $request_token['oauth_token_secret'] );
+                       $request_url = 'https://oauth.intuit.com/oauth/v1/get_access_token';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            $access_token = $oauth->get_access_token( $request_url, $_GET['oauth_verifier'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $access_token = $oauth->get_access_token( $request_url, $_GET['oauth_verifier'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            if ( is_wp_error( $access_token ) )
-                wp_die( 'Could not obtain an access token.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( is_wp_error( $access_token ) )
+                               wp_die( 'Could not obtain an access token.' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            // We have an access token.
-            $data = array(
-                'oauth_token' => $access_token['oauth_token'],
-                'oauth_token_secret' => $access_token['oauth_token_secret'],
-                'realmId' => $_GET['realmId'],
-            );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 // We have an access token.
+                       $data = array(
+                               'oauth_token' => $access_token['oauth_token'],
+                               'oauth_token_secret' => $access_token['oauth_token_secret'],
+                               'realmId' => $_GET['realmId'],
+                       );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            self::$options['auth'] = $data;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 self::$options['auth'] = $data;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            $oauth->set_token( self::$options['auth']['oauth_token'], self::$options['auth']['oauth_token_secret'] );
-            $request_url = sprintf( 'https://quickbooks.api.intuit.com/v3/company/%d/companyinfo/%d',
-                self::$options['auth']['realmId'], self::$options['auth']['realmId'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $oauth->set_token( self::$options['auth']['oauth_token'], self::$options['auth']['oauth_token_secret'] );
+                       $request_url = sprintf( 'https://quickbooks.api.intuit.com/v3/company/%d/companyinfo/%d',
+                               self::$options['auth']['realmId'], self::$options['auth']['realmId'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            $oauth_header = $oauth->get_oauth_header( 'GET', $request_url );
-            $response = wp_remote_get( $request_url, array( 'headers' => array(
-                'Authorization' => $oauth_header,
-                'Accept' => 'application/json',
-            ) ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $oauth_header = $oauth->get_oauth_header( 'GET', $request_url );
+                       $response = wp_remote_get( $request_url, array( 'headers' => array(
+                               'Authorization' => $oauth_header,
+                               'Accept' => 'application/json',
+                       ) ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            if ( is_wp_error( $response ) ) {
-                wp_die( 'Could not obtain company information.' );
-            }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( is_wp_error( $response ) ) {
+                               wp_die( 'Could not obtain company information.' );
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            $body = json_decode( wp_remote_retrieve_body( $response ), true );
-            if ( empty( $body['CompanyInfo'] ) ) {
-                wp_die( 'Could not obtain company information.' );
-            }
-            $company_name = $body['CompanyInfo']['CompanyName'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $body = json_decode( wp_remote_retrieve_body( $response ), true );
+                       if ( empty( $body['CompanyInfo'] ) ) {
+                               wp_die( 'Could not obtain company information.' );
+                       }
+                       $company_name = $body['CompanyInfo']['CompanyName'];
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            self::$options['auth']['name'] = $company_name;
-            self::$options['auth']['timestamp'] = time();
-            self::update_options();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 self::$options['auth']['name'] = $company_name;
+                       self::$options['auth']['timestamp'] = time();
+                       self::update_options();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            // Flush some caches.
-            delete_transient( md5( 'wordcamp-qbo:classes' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 // Flush some caches.
+                       delete_transient( md5( 'wordcamp-qbo:classes' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            wp_die( sprintf( 'Your QBO account (%s) has been linked. You can now close this window.', esc_html( $company_name ) ) );
-        }
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 wp_die( sprintf( 'Your QBO account (%s) has been linked. You can now close this window.', esc_html( $company_name ) ) );
+               }
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    /**
-     * Runs during admin_menu
-     */
-    public static function admin_menu() {
-        $cap = is_multisite() ? 'manage_network' : 'manage_options';
-        add_submenu_page( 'options-general.php', 'WordCamp QBO', 'QuickBooks',
-            $cap, 'wordcamp-qbo', array( __CLASS__, 'render_settings' ) );
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+        * Runs during admin_menu
+        */
+       public static function admin_menu() {
+               $cap = is_multisite() ? 'manage_network' : 'manage_options';
+               add_submenu_page( 'options-general.php', 'WordCamp QBO', 'QuickBooks',
+                       $cap, 'wordcamp-qbo', array( __CLASS__, 'render_settings' ) );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    /**
-     * Runs during admin_init.
-     */
-    public static function admin_init() {
-        register_setting( 'wordcamp-qbo', 'wordcamp-qbo', array( __CLASS__, 'sanitize_options' ) );
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+        * Runs during admin_init.
+        */
+       public static function admin_init() {
+               register_setting( 'wordcamp-qbo', 'wordcamp-qbo', array( __CLASS__, 'sanitize_options' ) );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    /**
-     * Runs whenever our options are updated, not necessarily
-     * in an admin or POST context.
-     */
-    public static function sanitize_options( $input ) {
-        self::load_options();
-        $output = self::$options;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+        * Runs whenever our options are updated, not necessarily
+        * in an admin or POST context.
+        */
+       public static function sanitize_options( $input ) {
+               self::load_options();
+               $output = self::$options;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        return $output;
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return $output;
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    /**
-     * Get an OAuth client object.
-     *
-     * @return WordCamp_QBO_OAuth_Client object.
-     */
-    private static function _get_oauth() {
-        static $oauth;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+        * Get an OAuth client object.
+        *
+        * @return WordCamp_QBO_OAuth_Client object.
+        */
+       private static function _get_oauth() {
+               static $oauth;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( ! isset( $oauth ) ) {
-            require_once( plugin_dir_path( __FILE__ ) . 'class-wordcamp-qbo-oauth-client.php' );
-            $oauth = new WordCamp_QBO_OAuth_Client( self::$consumer_key, self::$consumer_secret );
-        }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! isset( $oauth ) ) {
+                       require_once( plugin_dir_path( __FILE__ ) . 'class-wordcamp-qbo-oauth-client.php' );
+                       $oauth = new WordCamp_QBO_OAuth_Client( self::$consumer_key, self::$consumer_secret );
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        return $oauth;
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return $oauth;
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    /**
-     * Render the plugin settings screen.
-     */
-    public static function render_settings() {
-        self::load_options();
-        ?>
-        <style>
-        .qbo-connect {
-            width: 195px;
-            height: 34px;
-            display: inline-block;
-            background: url(<?php echo esc_url( plugins_url( '/images/qbo-connect.png', __FILE__ ) ); ?>) 0 0 no-repeat;
-            background-size: 195px 34px;
-            text-indent: -4000px;
-        }
-        </style>
-        <div class="wrap wordcamp-qbo-settings">
-            <h2>QuickBooks Settings</h2>
-            <form method="post" action="options.php">
-                <?php settings_fields( 'wordcamp-qbo' ); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+        * Render the plugin settings screen.
+        */
+       public static function render_settings() {
+               self::load_options();
+               ?>
+               <style>
+                       .qbo-connect {
+                               width: 195px;
+                               height: 34px;
+                               display: inline-block;
+                               background: url(<?php echo esc_url( plugins_url( '/images/qbo-connect.png', __FILE__ ) ); ?>) 0 0 no-repeat;
+                               background-size: 195px 34px;
+                               text-indent: -4000px;
+                       }
+               </style>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <h2>Account</h2>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <div class="wrap wordcamp-qbo-settings">
+                       <h2>QuickBooks Settings</h2>
+                       <form method="post" action="options.php">
+                               <?php settings_fields( 'wordcamp-qbo' ); ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <?php if ( ! empty( self::$options['auth']['name'] ) ) : ?>
-                <?php $expires = (int) ( 180 - ( time() - self::$options['auth']['timestamp'] ) / DAY_IN_SECONDS ); ?>
-                <p>Connected to <?php echo esc_html( self::$options['auth']['name'] ); ?>.
-                    <?php printf( _n( 'Expires in %d day.', 'Expires in %d days.', $expires ), $expires ); ?>
-                    <br />Use the button below to connect to a QuickBooks account.</p>
-                <?php endif; ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <h2>Account</h2>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <a href="#" class="qbo-connect">Connect to QuickBooks</a>
-                <?php wp_nonce_field( 'oauth-request', 'wordcamp-qbo-oauth-nonce' ); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <?php if ( ! empty( self::$options['auth']['name'] ) ) : ?>
+                                       <?php $expires = (int) ( 180 - ( time() - self::$options['auth']['timestamp'] ) / DAY_IN_SECONDS ); ?>
+                                       <p>Connected to <?php echo esc_html( self::$options['auth']['name'] ); ?>.
+                                               <?php printf( _n( 'Expires in %d day.', 'Expires in %d days.', $expires ), $expires ); ?>
+                                               <br />Use the button below to connect to a QuickBooks account.</p>
+                               <?php endif; ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <?php /* submit_button(); */ ?>
-            </form>
-        </div>
-        <script>
-        (function($){
-            $('.qbo-connect').on('click', function(){
-                var $form = $('.wordcamp-qbo-settings'),
-                    nonce = $form.find('input[name="wordcamp-qbo-oauth-nonce"]').val(),
-                    url = '<?php echo esc_js( add_query_arg( 'wordcamp-qbo-oauth-request', 1, admin_url() ) ); ?>',
-                    popup = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <a href="#" class="qbo-connect">Connect to QuickBooks</a>
+                               <?php wp_nonce_field( 'oauth-request', 'wordcamp-qbo-oauth-nonce' ); ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                url += '&wordcamp-qbo-oauth-nonce=' + nonce;
-                popup = window.open(url, 'qbo-oauth', 'width=800, height=560');
-                return false;
-            });
-        }(jQuery));
-        </script>
-        <?php
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <?php /* submit_button(); */ ?>
+                       </form>
+               </div>
+               
+               <script>
+                       (function($){
+                               $('.qbo-connect').on('click', function(){
+                                       var $form = $('.wordcamp-qbo-settings'),
+                                           nonce = $form.find('input[name="wordcamp-qbo-oauth-nonce"]').val(),
+                                           url = '<?php echo esc_js( add_query_arg( 'wordcamp-qbo-oauth-request', 1, admin_url() ) ); ?>',
+                                           popup = null;
+
+                                       url += '&wordcamp-qbo-oauth-nonce=' + nonce;
+                                       popup = window.open(url, 'qbo-oauth', 'width=800, height=560');
+                                       return false;
+                               });
+                       }(jQuery));
+               </script>
+               <?php
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> WordCamp_QBO::load();
</span></span></pre>
</div>
</div>

</body>
</html>