private static function line_item($line_items, $cost_fields, $quantity_fields, $description, $cost, $quantity, $is_fixed) { $select_display = $is_fixed ? "none" : "block"; $text_display = $is_fixed ? "block" : "none"; $str = "<tr class='gf_freshbooks_lineitem_row'>\r\n <td><select name='gf_freshbooks_lineitem[]' class='gf_freshbooks_lineitem'>{$line_items}</select></td>\r\n <td><input type='text' name='gf_freshbooks_item_description[]' value='{$description}'/></td>\r\n <td>\r\n <select name='gf_freshbooks_item_cost_field[]' class='gf_freshbooks_item_field' style='display:{$select_display}'>{$cost_fields}</select>\r\n <input type='text' name='gf_freshbooks_item_cost[]' class='gf_freshbooks_item_value' value='{$cost}' style='display:{$text_display}'/>\r\n </td>\r\n <td>\r\n <select name='gf_freshbooks_item_quantity_field[]' class='gf_freshbooks_item_field' style='display:{$select_display}'>{$quantity_fields}</select>\r\n <input type='text' name='gf_freshbooks_item_quantity[]' class='gf_freshbooks_item_value' value='{$quantity}' style='display:{$text_display}'/>\r\n </td>\r\n <td>\r\n <input type='image' src='" . GFFreshBooks::get_base_url() . "/images/remove.png' onclick='DeleteLineItem(this); return false;' alt='Delete' title='Delete' />\r\n <input type='image' src='" . GFFreshBooks::get_base_url() . "/images/add.png' onclick='AddLineItem(this); return false;' alt='Add line item' title='Add line item' />\r\n </td>\r\n </tr>"; return $str; }
/** * Gets an instance of the Freshbooks add-on main class * * @return GFFreshBooks */ function gf_freshbooks() { return GFFreshBooks::get_instance(); }
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.'); }