/** * @param Infusionsoft_App $app * @return string */ public static function getUrl(Infusionsoft_App $app = null) { if ($app == null) { $app = Infusionsoft_AppPool::getApp(); } $url = "https://{$app->getHostName()}/app/creditCardSubmission/addCreditCard"; return $url; }
public static function connect(Infusionsoft_TokenStorageProvider $tokenStorageProvider = null) { if ($tokenStorageProvider == null) { $tokenStorageProvider = Infusionsoft_AppPool::getDefaultStorageProvider(); } $hostName = $tokenStorageProvider->getFirstAppName(); return Infusionsoft_AppPool::addApp(new Infusionsoft_App($hostName)); }
public function __construct(Infusionsoft_Generated_Base $object, array $conditions = array(), $ttl = 300, $limit = 1000, $page = 0, $returnFields = false, Infusionsoft_App $app = null) { $this->object = $object; $this->conditions = $conditions; $this->limit = $limit; $this->page = $page; $this->returnFields = $returnFields; $this->app = $app; $this->app_name = $app == null ? Infusionsoft_AppPool::getApp()->getHostname() : $app->getHostname(); parent::__construct('objects_' . $this->object->getTable() . '_' . $this->app_name . '_' . md5(http_build_query($conditions) . $this->limit . $this->page . ($returnFields ? http_build_query($returnFields) : '') . $this->app_name), 600, dirname(__FILE__) . '/cache/'); }
public function __construct(Infusionsoft_Generated_Base $object, array $conditions = array(), $ttl = 300, $limit = 1000, $page = 0, $returnFields = false, Infusionsoft_App $app = null) { $this->object = $object; $this->conditions = $conditions; $this->limit = $limit; $this->page = $page; $this->returnFields = $returnFields; $this->app = $app; $this->app_name = $app == null ? Infusionsoft_AppPool::getApp()->getHostname() : $app->getHostname(); $directory = dirname(__FILE__) . '/cache'; // SmartCache class checks the Cache engine being used and shortens the "directory" if it is being used as the key in a caching system instead of as a file-name in a file-based cache. parent::__construct('objects_' . $this->object->getTable() . '_' . $this->app_name . '_' . md5(http_build_query($conditions) . $this->limit . $this->page . ($returnFields ? http_build_query($returnFields) : '') . $this->app_name), 600, $directory); }
protected static function getObjectOrDefaultAppIfNull(Infusionsoft_App $app = null, Infusionsoft_Generated_Base $object = null) { //If an app is explicitly set, skip this... if ($app == null) { //If the object has an app key, return it's app if ($object != null && $object->getAppPoolAppKey() != null) { $app = Infusionsoft_AppPool::getApp($object->getAppPoolAppKey()); } else { $app = Infusionsoft_AppPool::getApp(); } } return $app; }
public static function processAuthenticationScopeAndCode($scope, $code) { $parts = explode("|", $scope); $scope = array_shift($parts); $appDomain = array_shift($parts); $response = static::getToken($code); if (isset($response['error'])) { throw new Exception($response['error_description']); } /** @var Infusionsoft_App $app */ $app = Infusionsoft_AppPool::getApp($appDomain); if ($app == null) { $app = new Infusionsoft_App($appDomain); } $app->updateAndSaveTokens($response['access_token'], $response['refresh_token'], $response['expires_in']); return true; }
public function createBlankOrder($args) { //Remove Api Key array_shift($args); list($contactId, $description, $orderDate, $leadAffiliateId, $saleAffiliateId) = $args; $order = new Infusionsoft_Job(); $order->OrderType = 1; $order->ContactId = $contactId; $app = Infusionsoft_AppPool::getApp(''); $order->Id = $app->data->add(array($order->getTable(), $order->toArray())); $invoice = new Infusionsoft_Invoice(); $invoice->ContactId = $contactId; $invoice->DateCreated = date('Y-m-d H:i:s'); $invoice->JobId = $order->Id; $invoice->save(); return $invoice->Id; }
<?php $infusionsoft_host = 'joey.infusionsoft.com'; $infusionsoft_api_key = 'YOUR API KEY GOES HERE'; //To Add Custom Fields, use the addCustomField method like below. //Infusionsoft_Contact::addCustomField('_LeadScore'); //Below is just some magic... Unless you are going to be communicating with more than one APP at the SAME TIME. You can ignore it. Infusionsoft_AppPool::addApp(new Infusionsoft_App($infusionsoft_host, $infusionsoft_api_key, 443));
public static function clearApps() { self::$apps = array(); }
<?php include '../infusionsoft.php'; include 'testUtils.php'; $app = Infusionsoft_AppPool::getApp(); $app->enableDebug(); $contact = new Infusionsoft_Contact(1);
<?php include "../infusionsoft.php"; include 'testUtils.php'; $webforms = Infusionsoft_WebFormService::getMap(Infusionsoft_AppPool::getApp()); foreach ($webforms as $webformId => $webformName) { ?> <h1>Webform: <?php echo $webformId . '-' . $webformName; ?> </h1> <?php echo Infusionsoft_WebFormService::getHTML($webformId, Infusionsoft_AppPool::getApp()); ?> <hr><?php }
Ping Succeeded!!<br/><br/>Testing your API Key: by calling WebFormService.getMap. <br/> <?php try { Infusionsoft_WebFormService::getMap(Infusionsoft_AppPool::getApp()); ?> It Works! Everything is communicating properly and your API Key is correct.<?php } catch (Exception $e) { if (strpos($e->getMessage(), "[InvalidKey]") !== FALSE) { echo ' Failure!!! Your Key is not correct, please double check the key you put in the config.php with the APIKey in your apps Misc Settings.'; } else { echo ' Failure!!! Some other error: ' . $e->error; } } } else { ?> Something is wrong, see below for details, check your config file and try again. <?php } ?> <br /> <br /> <?php $exceptions = Infusionsoft_AppPool::getApp()->getExceptions(); foreach ($exceptions as $exception) { echo $exception->getMessage(); ?> <br /> <?php }
<?php if (session_id() == '') { session_start(); } require_once '../infusionsoft.php'; if (isset($_SESSION['appHostName'])) { Infusionsoft_AppPool::addApp(new Infusionsoft_App($_SESSION['appHostName'], $_SESSION['appKey'], $_SESSION['appPort'])); }