Exemple #1
0
 /**
  * Update email subscription status for an email address.
  *
  * @param int    $portal_id
  * @param string $email
  * @param array  $params
  * @return \SevenShores\Hubspot\Http\Response
  */
 function updateSubscription($portal_id, $email, $params = [])
 {
     $endpoint = "https://api.hubapi.com/email/public/v1/subscriptions/{$email}";
     $queryString = build_query_string(['portalId' => $portal_id]);
     $options['json'] = $params;
     return $this->client->request('put', $endpoint, $options, $queryString);
 }
function build_iframe_url($payer_name, $payee_id, $secret_key, $parameters = null)
{
    //$baseURL = "https://ui.tipalti.com"; //production
    $baseURL = "https://ui.sandbox.tipalti.com";
    //sandbox
    return $baseURL . "/Payees/PayeeDashboard.aspx?" . build_query_string($payer_name, $payee_id, $secret_key, $parameters);
}
Exemple #3
0
 /**
  * Search blog authors.
  *
  * @param string $q         Search query
  * @param array $params     Optional parameters.
  * @return \SevenShores\Hubspot\Http\Response
  */
 function search($q = '', $params = [])
 {
     $endpoint = 'https://api.hubapi.com/blogs/v3/blog-authors/search';
     $params['q'] = $q;
     $queryString = build_query_string($params);
     return $this->client->request('get', $endpoint, [], $queryString);
 }
	private function add_link($label, $params, $class= '') {
    $split_path = split('/', $this->base_path);
    foreach($split_path as &$path_item) {
      $path_item = str_replace('+', '%20', urlencode($path_item));
    }
    $path = join($split_path, '/');
		$this->links[] = array('label' => $label, 'href' => $path . build_query_string($params), 'class' => $class);
	}
Exemple #5
0
 /**
  * Trigger a custom event.
  *
  * This only works for enterprise accounts.
  *
  * @param  string $hubId               Your HubSpot portal ID ("Hub ID"). You can find your Hub ID in the
  *                                     footer of the HubSpot UI, or in the URL. For example, in this URL:
  *                                     "https://app.hubspot.com/reports/56043/events/" your Hub ID is "56043".
  * @param  string $eventId
  * @param  string $contactEmail        Optional - contact email.
  * @param  float  $contactRevenue      Optional - the monetary value this event means to you.
  * @param  array  $contactProperties   Optional - array of new contact properties.
  * @return \SevenShores\Hubspot\Http\Response
  */
 function trigger($hubId, $eventId, $contactEmail = null, $contactRevenue = null, $contactProperties = [])
 {
     $endpoint = sprintf("http://track.hubspot.com/v1/event?_a=%s&_n=%s", url_encode($hubId), url_encode($eventId));
     $contactProperties['email'] = $contactEmail;
     $contactProperties['_m'] = $contactRevenue;
     $query_string = build_query_string($contactProperties);
     return $this->client->request('get', $endpoint, [], $query_string);
 }
 public function call($path, $get_params = null, $post_params = null)
 {
     $curl = curl_init();
     // maybe move this to the constructor?
     if (!$curl) {
         Logger::error("Can't initialize curl", array('curlservice', 'service'));
         throw new CurlWebServiceException("Can't initialize curl");
     }
     $this->url = $this->base_url . '/' . $path;
     if ($get_params) {
         $this->url = $this->url . build_query_string($get_params);
     }
     $curl_options = array(CURLOPT_URL => $this->url, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HEADER => 0, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_USERAGENT => $GLOBALS['temovico']['service']['user_agent']);
     if ($post_params) {
         $curl_options[CURLOPT_POST] = 1;
         $curl_options[CURLOPT_POSTFIELDS] = $post_params;
     }
     if ($this->headers && is_array($this->headers)) {
         $curl_options[CURLOPT_HTTPHEADER] = $this->headers;
     }
     curl_setopt_array($curl, $curl_options);
     // We have to set these here instead of the by passing them with the $curl_options array or else they're ignored...weird
     curl_setopt($curl, CURLOPT_TIMEOUT_MS, $this->timeout);
     curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, $this->timeout);
     $this->requesting(array('service' => 'CurlWebService', 'url' => $this->url, 'POST' => $post_params));
     $this->result = curl_exec($curl);
     $this->curl_info = curl_getinfo($curl);
     $this->curl_errno = curl_errno($curl);
     $this->curl_error = curl_error($curl);
     // Deal with errors
     // For a list of curl error codes, see http://curl.haxx.se/libcurl/c/libcurl-errors.html
     if ($this->curl_errno > 0) {
         $result_info = array('HTTP Code' => $this->http_code(), 'curl errno' => $this->curl_errno, 'curl error' => $this->curl_error);
         switch ($this->curl_errno) {
             // TODO: add handling for more errors
             case 28:
                 // It's a timeout
                 $result_info['message'] = "Curl timed out on {$this->url} with \$connect_timeout = {$this->connect_timeout}ms, \$timeout = {$this->timeout}ms";
                 $this->received($result_info);
                 throw new CurlWebServiceException($message, $this->url, $this->curl_errno, $this->curl_error);
             default:
                 // Catchall for other errors
                 $message = "Curl error on {$this->url}: ({$this->curl_errno}) {$this->curl_error}";
                 $result_info['message'] = $message;
                 $this->received($result_info);
                 throw new CurlWebServiceException($message, $this->url, $this->curl_errno, $this->curl_error);
         }
     } else {
         $this->received(array('HTTP Code' => $this->http_code(), 'result' => $this->result));
     }
     curl_close($curl);
     return $this->result;
 }
<?if(isset($ads) && is_array($ads) && count($ads)>0):?>

	<?foreach($ads as $row):?>
	 
		<?$qry = build_query_string(array('id'=>$row['id']))?>
		
		<div class="ad-panel">		
			<a class='picture' title="<?php 
echo $row['title'];
?>
" href="ad.php?<?php 
echo $qry;
?>
" name="<?php 
echo $row['id'];
?>
">
				<img alt="<?php 
echo $row['title'];
?>
" src="<?php 
echo $row['thumb'];
?>
" />
			</a>
			<div class="details">
				<h3 class='subject'><a href="ad.php?<?php 
echo $qry;
?>
"><?php 
echo $row['title'];
Exemple #8
0
 /**
  * @param array $params
  * @return \SevenShores\Hubspot\Http\Response
  */
 function all($params = [])
 {
     $endpoint = 'https://api.hubapi.com/owners/v2/owners';
     $queryString = build_query_string($params);
     return $this->client->request('get', $endpoint, [], $queryString);
 }
				<?php 
if ($tct < 1) {
    print "<tr><td colspan='4'>No records.</td></tr>";
}
foreach ($expiries as $row) {
    ?>
					<tr>
						<?php 
    print "<td>" . $row['id'] . "</td>";
    print "<td>" . $row['name'] . "</td>";
    print "<td>" . $row['period'] . "</td>";
    ?>
	
						<td>
							<a href=<?php 
    print 'expiry-edit.php?' . build_query_string(array('id' => $row['id']));
    ?>
>Edit</a>		
							<a href=<?php 
    print "'" . $_SERVER['SCRIPT_NAME'] . "?d=" . $row['id'] . "&t=" . time() . "#table'";
    ?>
 onclick="return confirm ('Are you sure to delete?')">Delete</a>
							<a href=<?php 
    print "'" . $_SERVER['SCRIPT_NAME'] . "?o=" . $row['id'] . "&r=0&t=" . time() . "#table'";
    ?>
>Up</a>
							<a href=<?php 
    print "'" . $_SERVER['SCRIPT_NAME'] . "?o=" . $row['id'] . "&r=1&t=" . time() . "#table'";
    ?>
>Down</a>
						</td>	
      <a id="filter-readonly" class="glyphicon glyphicon-<?php 
echo $unread ? 'check' : 'unchecked';
?>
" href="<?php 
echo uri('articles') . build_query_string(array('category' => $category, 'unread' => $unread ? 0 : 1));
?>
">只显示未读</a>
    </div>
    <div>
      <ul id="category" class="dropdown-content">
        <li><a href="<?php 
echo uri('articles') . build_query_string(array('category' => null, 'unread' => $unread));
?>
">所有</a></li>
<?php 
foreach (UserWechatCategory::findAll() as $category) {
    ?>
        <li><a href="<?php 
    echo uri('articles') . build_query_string(array('category' => $category->getId(), 'unread' => $unread));
    ?>
"><?php 
    echo $category->getName();
    ?>
</a></li>
<?php 
}
?>
      </ul>
    </div>
  </div>
</div>
 /** @test */
 public function build_nested_batch_with_encoding_RFC1738()
 {
     $query = ['email' => '*****@*****.**', 'description' => 'two words', 'property' => ['firstname', 'lastname']];
     $queryString = build_query_string($query, PHP_QUERY_RFC1738);
     $this->assertEquals('&email=test%40test.com&description=two+words&property=firstname&property=lastname', $queryString);
 }
Exemple #12
0
 /**
  * Get all blog posts.
  *
  * @param  array $params Optional parameters.
  * @return \SevenShores\Hubspot\Http\Response
  */
 function all($params = [])
 {
     $endpoint = "https://api.hubapi.com/content/api/v2/blog-posts";
     $queryString = build_query_string($params);
     return $this->client->request('get', $endpoint, [], $queryString);
 }
Exemple #13
0
 /**
  * Get recently added contact from a list.
  *
  * @param int   $id List id
  * @param array $params
  * @return \SevenShores\Hubspot\Http\Response
  */
 function recentContacts($id, $params = [])
 {
     $endpoint = "https://api.hubapi.com/contacts/v1/lists/{$id}/contacts/recent";
     $queryString = build_query_string($params);
     return $this->client->request('get', $endpoint, [], $queryString);
 }
Exemple #14
0
 /**
  * Get email events for a campaign or recipient.
  *
  * @param array $params Optional parameters
  * @return \SevenShores\Hubspot\Http\Response
  */
 function all($params = [])
 {
     $endpoint = "https://api.hubapi.com/email/public/v1/events";
     $queryString = build_query_string($params);
     return $this->client->request('get', $endpoint, [], $queryString);
 }
 /**
  * Get contact property groups.
  *
  * Returns all of the contact property groups for a given portal.
  *
  * @see http://developers.hubspot.com/docs/methods/contacts/v2/get_contact_property_groups
  *
  * @param bool $includeProperties
  * @return \SevenShores\Hubspot\Http\Response
  */
 function getGroups($includeProperties = false)
 {
     $endpoint = "https://api.hubapi.com/contacts/v2/groups";
     $queryString = build_query_string(['includeProperties' => $includeProperties]);
     return $this->client->request('get', $endpoint, [], $queryString);
 }
    if ($row['parent'] == 0) {
        print "<a href='" . $_SERVER['SCRIPT_NAME'] . '?' . build_query_string(array('parent' => $row['id'])) . "#table'>Subcategories(" . $row['childcount'] . ")</a>";
    }
    ?>
					</td>	
				</tr>
				<?php 
}
?>
			</tbody>

		</table>

		<?php 
if ($parent > 0) {
    print "<br /><a class='up-one-level' href='" . $_SERVER['SCRIPT_NAME'] . '?' . build_query_string(array('parent' => 0, 't' => time(), 'o' => -1, 'r' => -1, 'd' => -1, "pageID{$parent}" => -1)) . "'>Up</a><br />";
}
?>

		<br />
		
		<?php 
echo $pager->links;
?>

		<br />
	</div>

</div>

<br />
Exemple #17
0
 protected function buildQuery($query = [])
 {
     return build_query_string($query);
 }
				<?php 
if ($tct < 1) {
    print "<tr><td colspan='4'>No records.</td></tr>";
}
foreach ($responses as $row) {
    ?>
					<tr>
						<?php 
    print "<td>" . $row['id'] . "</td>";
    print "<td><a href='ad-edit.php?id=" . $row['ad_id'] . "'>" . $row['ad_id'] . "</a></td>";
    print "<td><a href='user-edit.php?id=" . $row['user_id'] . "'>" . $row['user_id'] . "</a></td>";
    ?>
	
						<td>
							<a href=<?php 
    print 'response-edit.php?' . build_query_string(array('id' => $row['id']));
    ?>
>Edit</a>		
							<a href=<?php 
    print "'" . $_SERVER['SCRIPT_NAME'] . "?d=" . $row['id'] . "&t=" . time() . "#table'";
    ?>
 onclick="return confirm ('Are you sure to delete?')">Delete</a>
						</td>	
					</tr>
				<?php 
}
?>
			</tbody>

		</table>
		
Exemple #19
0
function get_professor_distribution($col, $search_term, $params, $user_id = Null)
{
    $cols = array($col, "prof.id");
    $query = "select {$col}, count(*) from (" . build_query_string($cols, $search_term, $params, $user_id) . ") as T group by {$col} order by count(*) desc";
    return query_or_die($query, get_con());
}
Exemple #20
0
/**
* Update a $_REQUEST parameter value and output the query string
*/
function update_query_string($input)
{
    $url = explode('?', get_cur_page_url());
    $url = $url[0];
    $params = $_GET;
    foreach ($input as $key => $val) {
        $params[$key] = $val;
    }
    return $url . build_query_string($params);
}
}
foreach ($users as $row) {
    ?>
					<tr>
						<?php 
    print "<td>" . $row['id'] . "</td>";
    print "<td>" . $row['name'] . "</td>";
    print "<td>" . $row['username'] . "</td>";
    print "<td>" . $row['email'] . "</td>";
    print "<td>" . $row['createdon'] . "</td>";
    print "<td>" . $row['active'] . "</td>";
    ?>
	
						<td>
							<a href=<?php 
    print "'" . $_SERVER['SCRIPT_NAME'] . '?' . build_query_string(array('d' => $row['id'], 't' => time())) . "#table'";
    ?>
 onclick="return confirm ('Are you sure to delete?')">Delete</a>
						</td>	
					</tr>
				<?php 
}
?>
			</tbody>
		</table>

		<br />

		<?php 
echo $pager->links;
?>
<div id="middle">

	<?if($exists):?>

		<div id='ad-view'>
			<p>
				<?if($ad['sub_region']==''):?><a href="ad-list.php?<?php 
echo build_query_string(array('region' => $ad['main_region_slug'], 'id' => -1));
?>
"><?php 
echo $ad['main_region'];
?>
</a> &gt; <?endif?>
				<?if($ad['sub_region']!=''):print '<a href="ad-list.php?region=' . build_query_string(array('region'=>$ad['sub_region_slug'],'id'=>-1)) . '">' . substr($ad['sub_region'],0,50) . '</a> &gt; ';endif?>
				<a href="ad-list.php?<?php 
echo build_query_string(array('category' => $ad['main_category_slug'], 'id' => -1));
?>
"><?php 
echo $ad['main_category'];
?>
</a>
				<?if($ad['sub_category']!=''):print ' &gt <a href="ad-list.php?' . build_query_string(array('category'=>$ad['sub_category_slug'],'id'=>-1)) . '">' . substr($ad['sub_category'],0,50) . '</a>';endif?>
			</p>
			
			<h3><?php 
echo $ad['title'];
?>
</h3>
				
			<div class='ad-data'>
				
Exemple #23
0
 /**
  * Returns all engagements.
  *
  * @param array $params Array of optional parameters ['limit', 'offset']
  *
  * @see http://developers.hubspot.com/docs/methods/engagements/get-all-engagements
  *
  * @return \SevenShores\Hubspot\Http\Response
  */
 public function all($params = [])
 {
     $endpoint = 'https://api.hubapi.com/engagements/v1/engagements/paged';
     $queryString = build_query_string($params);
     return $this->client->request('get', $endpoint, [], $queryString);
 }
Exemple #24
0
 /**
  * @param int $dealId
  * @param int|int[] $contactIds
  * @return mixed
  */
 function disassociateFromContact($dealId, $contactIds)
 {
     $endpoint = "https://api.hubapi.com/deals/v1/deal/{$dealId}/associations/CONTACT";
     $queryString = build_query_string(['id' => (array) $contactIds]);
     return $this->client->request('delete', $endpoint, [], $queryString);
 }
Exemple #25
0
 /**
  * Get meta data for all files.
  *
  * @param array $params Optional parameters
  * @return \SevenShores\Hubspot\Http\Response
  */
 function all($params = [])
 {
     $endpoint = "https://api.hubapi.com/filemanager/api/v2/files";
     $queryString = build_query_string($params);
     return $this->client->request('get', $endpoint, [], $queryString);
 }
Exemple #26
0
 /**
  * For a given portal, return contacts and some data associated with
  * those contacts by the contact's email address or name.
  *
  * Please note that you should expect this method to only return a small
  * subset of data about the contact. One piece of data that the method will
  * return is the contact ID (vid) that you can then use to look up much
  * more data about that particular contact by its ID.
  *
  * @see http://developers.hubspot.com/docs/methods/contacts/search_contacts
  *
  * @param string $query  Search query
  * @param array  $params Array of optional parameters ['count', 'offset']
  * @return \SevenShores\Hubspot\Http\Response
  */
 function search($query, $params = [])
 {
     $endpoint = "https://api.hubapi.com/contacts/v1/search/query";
     $params['q'] = $query;
     $queryString = build_query_string($params);
     return $this->client->request('get', $endpoint, [], $queryString);
 }
Exemple #27
0
 /**
  * Get upcoming (scheduled) events for a contact in a workflow.
  *
  * @param int   $workflow_id
  * @param int   $contact_id
  * @param array $params
  * @return \SevenShores\Hubspot\Http\Response
  */
 function upcomingEventsForContact($workflow_id, $contact_id, $params = [])
 {
     $endpoint = "https://api.hubapi.com/automation/v2/workflows/{$workflow_id}/logevents/contacts/{$contact_id}/upcoming";
     $queryString = build_query_string($params);
     return $this->client->request('get', $endpoint, [], $queryString);
 }
Exemple #28
0
 /**
  * Returns all of the contact IDs who are associated with the given company
  * @param int $companyId The id of the company.
  * @param array $params Array of optional parameters ['count', 'vidOffset']
  *
  * @see http://developers.hubspot.com/docs/methods/companies/get_company_contacts_by_id
  *
  * @return \SevenShores\Hubspot\Http\Response
  */
 function getAssociatedContactIds($companyId, $params = [])
 {
     $endpoint = "https://api.hubapi.com/companies/v2/companies/{$companyId}/vids";
     $queryString = build_query_string($params);
     return $this->client->request('get', $endpoint, [], $queryString);
 }
if ($tct < 1) {
    print "<tr><td colspan='5'>No records.</td></tr>";
}
foreach ($reviews as $row) {
    ?>
					<tr>
						<?php 
    print "<td>" . $row['id'] . "</td>";
    print "<td><a href='ad-edit.php?id=" . $row['ad_id'] . "'>" . $row['ad_id'] . "</a></td>";
    print "<td><a href='user-edit.php?id=" . $row['user_id'] . "'>" . $row['user_id'] . "</a></td>";
    print "<td>" . $row['rate'] . "</td>";
    ?>
	
						<td>
							<a href=<?php 
    print 'ad_review-edit.php?' . build_query_string(array('id' => $row['id']));
    ?>
>Edit</a>		
							<a href=<?php 
    print "'" . $_SERVER['SCRIPT_NAME'] . "?d=" . $row['id'] . "&t=" . time() . "#table'";
    ?>
 onclick="return confirm ('Are you sure to delete?')">Delete</a>
						</td>	
					</tr>
				<?php 
}
?>
			</tbody>

		</table>
		
 /**
  * Returns all of the company property groups for a given portal.
  * @param bool $includeProperties If true returns all of the properties for each company property group.
  *
  * @see http://developers.hubspot.com/docs/methods/companies/get_company_property_groups
  *
  * @return \SevenShores\Hubspot\Http\Response
  */
 function getAllGroups($includeProperties = false)
 {
     $endpoint = 'https://api.hubapi.com/companies/v2/groups/';
     if ($includeProperties) {
         $queryString = build_query_string(['includeProperties' => 'true']);
         return $this->client->request('get', $endpoint, [], $queryString);
     }
     return $this->client->request('get', $endpoint);
 }