private static function init_api()
 {
     require_once GFFreshBooks::get_base_path() . '/api/Client.php';
     require_once GFFreshBooks::get_base_path() . '/api/Invoice.php';
     require_once GFFreshBooks::get_base_path() . '/api/Estimate.php';
     require_once GFFreshBooks::get_base_path() . '/api/Item.php';
     $url = "https://" . get_option("gf_freshbooks_site_name") . ".freshbooks.com/api/2.1/xml-in";
     $authtoken = get_option("gf_freshbooks_auth_token");
     self::log_debug("Initializing API - url: {$url} - token: {$authtoken}");
     FreshBooks_HttpClient::init($url, $authtoken);
     self::log_debug("API Initialized.");
 }
Esempio n. 2
0
<?php

/**
 * Copy this file as init.php and update url and token
 */
define("LIB_PATH", realpath(dirname(__FILE__) . '/../../library'));
include_once LIB_PATH . '/FreshBooks/HttpClient.php';
//you API url and token obtained from freshbooks.com
$url = "";
$token = "";
//init singleton FreshBooks_HttpClient
FreshBooks_HttpClient::init($url, $token);
 private function init_api()
 {
     require_once GFFreshBooks::get_base_path() . '/api/Client.php';
     require_once GFFreshBooks::get_base_path() . '/api/Invoice.php';
     require_once GFFreshBooks::get_base_path() . '/api/Estimate.php';
     require_once GFFreshBooks::get_base_path() . '/api/Item.php';
     require_once GFFreshBooks::get_base_path() . '/api/Payment.php';
     $settings = $this->get_plugin_settings();
     $url = 'https://' . $settings['siteName'] . '.freshbooks.com/api/2.1/xml-in';
     $authtoken = $settings['authToken'];
     $this->log_debug(__METHOD__ . "(): Initializing API - url: {$url} - token: {$authtoken}");
     FreshBooks_HttpClient::init($url, $authtoken);
     $this->log_debug(__METHOD__ . '(): API Initialized.');
 }